Android :: Change Orientation Without OnCreate Call / Any Auto Adjacent Property?

Oct 29, 2010

I want to change layout without calling the onCreate method. i also define android:configChanges="orientation|keyboardHidden" in my activity and it is not calling the onCreate method but the layout not adjust appropriately on landscape mode.

my current layout look like as follows.

after change orientation as landscape it look like as follows:

but on landscape i want the following result.

is there any auto adjacent property?

how can i do it?

Android :: Change orientation without onCreate call / Any auto adjacent property?


Android :: Extra Call To OnCreate On Orientation Change

Jun 20, 2010

I've been experimenting with orientation change and have seen a strange behavior (at least to my opinion) when I change the orientation from landscape to portrait. To make the explanation more concrete let's consider the following super-simple code:

CODE:...................

I put breakpoints at lines 9 and 15 and start the emulator in debug mode. The application starts and hits the breakpoint at line 9; so far so good. Then I press Ctrl+F11 to change the orientation from portrait to landscape. The debugger stops first at line 15 and then line 9. Everyhting normal so far. I hit once again Ctrl+F11 to change the orientation from landscape to portrait and some mumbo-jumbo starts happening. Here is the sequence of function calls I observe: 1.onDestroy() 2.onCreate() 3.onDestroy() 4.onCreate()

I really fail to understand why the platform needs to make the calls "2.onCreate()" and "3.onDestroy()". Can anyone explain why this is happening? At least I don't find it convenient because I need to implement more logic, because the extra calls "2.onCreate()" and "3.onDestroy()" cause side effects in my case. However, it would be interesting to know why these extra calls are taking place.

View 5 Replies View Related

Android :: OnCreate And Orientation Change

Apr 28, 2010

I have an activity that checks stuffs online when it's created (is the GPS on and if not it asks if the user wants to turn it on).

The problem I'm having is that it is also doing it everytime I change the orientation of the screen.

I've read some comments on onConfigurationChanged() but is there a better way to be sure I'm checking the GPS only when the activity is first created?

View 4 Replies View Related

Android :: Android Orientation Change Calls OnCreate

Jun 22, 2010

I've made a search screen that has one tab for keywords, filters, and a search button, and three optional tabs for the different types of results (each containing a ListView with an ArrayAdapter). When starting the activity, the developer can optionally pass in the results as an extra Parcelable[] if the search has already been performed. In the onCreate() method I'm creating each of the three tabs for the Parcelable[] passed through.

When I call a search from the button on the filter tab, I clear the tabs and recreate them with the new results, which works perfectly. The problem is that when you rotate the device, it appears that Android's automatic orientation switching support recreates the entire activity, calling onCreate(). This means that my search results are reset to the Parcelable[] passed through when starting the activity. The only solution I've had so far is to call finish() then startActivity() to essentially restart the activity with the new results. I'm sure there must be a much simpler solution and that I've done something extremely noobish.

View 1 Replies View Related

Android :: Change Screen Orientation When Call Is Ongoing / Phone Process Will Crash

Jun 15, 2009

I found if change screen orientation continouously when a call is ongoing, that is, portrait -> landscape -> portrait- >landscape.

View 3 Replies View Related

Android :: Two OnCreate (and OnDestroy) Invocations On Orientation Chage

Jan 4, 2010

With following simple code (on clean, new android project):

CODE:..............................

View 5 Replies View Related

Android :: Why Are OnCreate() OnStart() Etc Called When Handset Orientation Is Changed

Dec 14, 2009

I got my hands on Android which is really fun. But at some point I don't seem to understand the concept. I've got a Main class which reads like this:

CODE:....

In the onCreate(...) I set the layout to setContentView(R.layout.main); and add an OnTouchEvent Listener to the sole View in main.xml: myView.setOnTouchListener(new OnTouchListener() {@Override public boolean onTouch(View v, MotionEvent event){...

As you can see I also implemented a SensorEventListener which is used if required. All works fine so far.

But my problem is this (at this point my misunderstanding kicks in): whenever I rotate the device the onCreate(), onStart() etc. methods are called, causing my app to act as if it just started. Furthermore, I feel unable to implement an onSizeChanged(int w, int h, int oldw, int oldh) { ... } Listener.

Can anyone please explain where my error in reasoning is? I am working on a tiny app which is more or less done, except for the just mentioned bug(s). Maybe I got it all wrong but it does what it is supposed to do (i.e. sending touch positions and accelerometer data over the network via UDP).

View 14 Replies View Related

Android : Way To Call Phone Layout_gravity Property From A Java Method

May 31, 2010

I would like to know if is there a way to call android:layout_gravity property from a java method. I didn't found any method in Android documentation to do it. This is the picture of the layout I want to implement: But in my situation, I need to do it through Java code, because I'll implement another layout views dinamically. To avoid merging xml layout with Java code, I would prefer make all layout using Java. Code...

View 2 Replies View Related

Android :: Orientation Change - Dialog Above Activity With Fixed Orientation

May 14, 2009

I have created an activity for my game which handles all orientation changes by itself and has a fixed "portrait" layout. Actually it uses the accelerometer and is rendered using 2D canvas methods. If the level has been completed I show up a highscore dialog in which the user can enter his name. The dialog is floating above the underlying level screen which gets blurred out nicely. This generally works.

Problem is that the dialog does not get rotated if the orientation of the phone changes. So even if the keyboard is exposed the dialog is shown in portrait mode instead of landscape. I have tried to use an activity with dialog theme instead but the behavior didn't change. After several tries it seems that I have found the reason for this: Once there's an activity with fixed orientation in the activity stack then all subsequent activities keep this orientation, too. They will not react on orientation changes anymore (e.g. if the keyboard gets exposed).

After upgrading to 1.5 SDK the described behavior changed a little bit. Now at subactivities indead react on orientation changes like expected. However, the need to have an opaque background! That means that neither dialogs nor activities with dialog theme will work. Those will stick with the orientation of the underlaying activity. So my workaround is to first start a sub-activity with an opaque black background. This activity then shows my highscore dialog on top. It looks quite okay but I wonder if there's a better solution? Is it possible to show a dialog above a fixed portrait or landscape activity which automatically adapts to orientation changes?

View 3 Replies View Related

General :: Change Screen Size Property Of Device?

Apr 4, 2012

I have a 7 inch tablet (Novo 7 Paladin) running ICS. Unfortunately, most apps just use the phone layout wich I assume is because the manufacturer set the android:screenSize property to "large" instead of "xlarge".

Is there a way to change this, so that Apps will use the "xlarge" screen layout?

View 2 Replies View Related

Android : Call OnCreate Each Time App Starts

Apr 5, 2010

How to call Activity's onCreate() method each time it starts?

Only first time when installed on device it calls onCreate method.

View 3 Replies View Related

Android :: Can't Call Service Function In Activity's OnStart / OnCreate?

Sep 28, 2009

My activity bind a service. I want to call the service's function in activity's onStart/onCreate function, but it doesn't work. The service started sunless but the connection is null. When I just call the service's function in other function (onClick for example),

View 4 Replies View Related

Android :: Custom View Gets Drawn Only When Added In OnCreate / Put Call?

Nov 12, 2010

I made a "GraphBar" custom view that is a RelativeLayout with a TextView on the bottom and an ImageView, varying in height, above that. Here is the code...

I've found it's probably a bug. The workaround should be, again, calling requestLayout(). Still i don't understand where i can put the call.

View 1 Replies View Related

Android :: Change Intent Bundle Data Before Activity Recreated After Orientation Change

Jul 30, 2009

I have a notification that starts my activity and passes a messages using the intent's putExtra() function. The message is then displayed to the user in the activity's onCreate function. When the application is restarted due to a orientation change, the message is shown again as it is still in the intent's bundled data.
How can I remove the extra data?

I tried the following:

Bundle bundle = getIntent().getExtras();
if (bundle.getBoolean("showMessage")) {
// ... show message that is in bundle.getString("message")
// remove message
bundle.remove("showMessage");
}

But the message will still be shown after the orientation changed, seems like the intent used is not the one I changed, but the original one. The only workaround I found is to save the showMessage additionally in onSaveInstanceState(). Is there another way? Or is this the way to go?

View 2 Replies View Related

Android :: Change Widget Dimensions On Orientation Change

Jul 22, 2010

I have a widget which has say, a dimension of 294*72(portrait). But when the orientation is changed, I need to change this dimension of the widget to another dimension which would look good on the landscape orientation.

View 4 Replies View Related

Android :: Change Background After Orientation Change

Jun 8, 2010

I have an image set as my background and when it is vertical, the image looks fine. However, when the orentation is changed, the image get streched out. If there a way that I can change the image based on the orentation of the device?

View 4 Replies View Related

HTC Magic :: Auto Orientation Not Working On Home Screen

May 12, 2009

I'm the proud owner of the HTC Magic on Vodafone UK. I'm loving the Android.I have to say that after 5 days of owning this device I'm only left scratching my head on one point the auto-orientation of the home screen.I've seen videos of rooted G1's running the hacked 1.5 firmware and the recently posted video of the Samsung i7500 with the 1.5 firmware all CLEARLY show that when the device is on home screen, the desktop (read home screen) auto-rotates depending on the orientation of the device. The Samsung video shows it working in ALL FOUR orientations!This doesn't happen on my Magic . Flip the orientation in an application? Works fine. Flip it back in an application? Works fine. Do it on the home screen?Am I missing something? Is this a feature that is disabled in the offical 1.5 Cupcake release? If that's the case - fine with me. I'll stop scratching my head and move on.

View 9 Replies View Related

Android :: System.setProperty - Cannot Change System Property In Android

Sep 23, 2009

I use Java API "System.setProperty()" to set a system property. After invoke "System.setProperty()", API "System.getProperty()" can return the value just I set. However, when I use command "adb shell getprop" to verify, it shows that this property is not set at all. Do I wrongly understand API "System.setProperty()" ?

View 9 Replies View Related

Android :: Force Screen Orientation And Destroy Call

Aug 27, 2009

I want my Activity to be always in portrait mode and I do NOT want the onDestroy() method to be called. There are some interesting articles about that at: http://www.androidguys.com/2008/11/24/rotational-forces-part-four/

The solution seems to be: In AndroidManifest.xml:

CODE:...............

I've tried it and it seems to work. Is there any other alternative or is it the correct solution?

View 7 Replies View Related

HTC EVO 4G :: Change GSM Auto Prl To CDMA Auto

Jun 11, 2010

I was wondering what does this change and how (other than better battery life...supposedly) will this affect my phone? Will it continue to work the same as before? or will it only work in sprint network with no roaming or what?

View 41 Replies View Related

Android :: Change Orientation Of AlertDialog

Mar 25, 2009

I am building a AlertDialog in java code, so by default it is portrait but I want to show it in landscape orientation. How to do it in Java code?

View 2 Replies View Related

Android :: Screen Orientation Change

Oct 8, 2009

I notice when using the emulator that when the screen is flipped, I get a following logcat message:

INFO/WindowManager(589): onOrientationChanged, rotation changed to 1

How can I catch this in the code? I want to know whenever the orientation changes. I assume I have to set a listener, but I can't find an example anywhere.

View 6 Replies View Related

Android :: Dialogs On A Change Orientation

Mar 5, 2010

I'm doing an APP that shows some dialogs. Those dialogs are Alert dialogs, and when they are being showed if I change the orientation of the mobile I lost them...they are not being kept on the screen.

View 13 Replies View Related

Android :: Views - Orientation Change

Oct 1, 2009

Do Views know changes in orientation? In my case, I create popups from TextView and need to know when the orientation changes(porttrait<-- >landscape). I cannot depend on activity's onOrientationChange.

View 2 Replies View Related

Android :: Keep Screen On And Change Orientation

Feb 11, 2009

I am making an Android app which is currently coming along nicely - I've hit upon a couple of stumbling blocks.

1) How do I stop the screen from going dim/off and the phone locking while the application is running?

2) Can I force the phone to enter landscape mode on running my application?

View 2 Replies View Related

Android :: Possible Leak In Orientation Change

Jul 1, 2009

My app *sometimes* when orientation change, leaks Activities (getInstanceCount() increases from time to time) and i cannot figure out where references to my Activity or rather Context are kept - tried to use jhat but it couldn't help me much.

what is strange: it doesn't always happen on orientation change, so its even harder to fix.

btw when doing normal app life cycle - start, do something, exit - everything is ok - getInstanceCount() always returns 1.

View 5 Replies View Related

Android :: Dialog Is Leaked On Orientation Change

Jun 23, 2010

built a simple app that displays an alertDialog with two buttons.The problem is it's not getting dismissed when i change orientation. After change i get a leak warning on debugger and the dialog appears twice(pressing back hides the first dialog, only a second back dismisses it completely).

View 7 Replies View Related

Android :: Change Eclipse Layout Orientation

Nov 6, 2010

I want to know how to change the orientation of my layout inside of eclipse but when I click the "layout" button it still shows it as a vertical layout.

View 4 Replies View Related

Android :: How To Change Eclipse Layout Orientation?

Nov 6, 2010

I want to know how to change the orientation of my layout inside of eclipse.

View 1 Replies View Related

Android :: Orientation Change Crashes When Ids Not Unique

Mar 17, 2009

consider the simple layout:

CODE:..................

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved