App restarts when screen is rotated

by Digeridoo » Wed, 27 Apr 2011 04:53:13 GMT


Sponsored Links
 Hi All,

My game app resets to start position when I rotate the phone from
portrait to landscape or the other way round. Do I need to disable the
gravity sensor and do I do this in the OnCreate method?

-- 



Re: App restarts when screen is rotated

by Farah Hanif » Wed, 27 Apr 2011 04:58:15 GMT


 You need to get configChanges of your activity to "orientation".  This means
that app will handle all the orientation changes by itself.

See
 http://developer.android.com/guide/topics/manifest/activity-element.html #config

  android:configChanges
< http://developer.android.com/guide/topics/manifest/activity-element.html #config>=["mcc",
"mnc", "locale",
                                 "touchscreen", "keyboard", "keyboardHidden",
                                 "navigation", "orientation", "screenLayout",
                                 "fontScale", "uiMode"]



On Tue, Apr 26, 2011 at 4:53 PM, Digeridoo







-- 
*Farah Hanif*
613-851-9128

-- 


Sponsored Links


Re: App restarts when screen is rotated

by lbendlin » Wed, 27 Apr 2011 04:58:51 GMT


 Activities are destroyed and recreated by default when the orientation 
changes. If you don't like that you can use various methods to either 
prevent that from happening (by handling orientation changes yourself) or to 
restore the state of the activity. 

-- 



Re: App restarts when screen is rotated

by TreKing » Wed, 27 Apr 2011 05:31:36 GMT


 On Tue, Apr 26, 2011 at 3:53 PM, Digeridoo




 http://developer.android.com/reference/android/app/Activity.html #ConfigurationChanges


-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 



Re: App restarts when screen is rotated

by Indicator Veritatis » Wed, 27 Apr 2011 06:25:36 GMT


 Of the two approaches lbendlin mentions, the latter is more commonly
recommended. I used to know why.




-- 



Re: Re: App restarts when screen is rotated

by TreKing » Wed, 27 Apr 2011 06:30:36 GMT


 



Because your app can be killed and recreated by other means - like when the
user presses Home and does other things for a while. If you properly handle
saving and restoring instance state, you'll survive this case as well. If
you only handle the config changes, then you will fail this case and a user
coming back to your game will have to start over.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 



Other Threads

1. ColorPicker Query

Hi All,


Hi Folks ,

I have 2 questions :-

1. When I use the ColorPickerDialog.OnColorChangedListener I make sure
that  the colorChanged sets the selected color on the paint object I
am using. That being said, I see that on my screen say I am painting
it with red color and then I choose blue the things I previously
painted also turns blue instead I want what would be painted from now
on on the screen to turn blue. What would I be missing.


2. When I call erase from the menu options  I use the follow code

mPaint.setXfermode(new PorterDuffXfermode(
 
PorterDuff.Mode.CLEAR));


it clears the whole screen fine but I cant draw anymore.


Thanks,
Gurudutta

-- 

2. Monkey Patching?

I am having difficulties accomplishing a monkey patch.  Is this even
possible?

My goal.

make org.apache.http.messaging.HeaderGroup implement Serializable
(really just use the 4.1 version)
so that it could be passed to an ObjectOutputStream.

Is there a way to do this?

Currently, I am getting a SerilazationException when passing an
HttpEntry to ObjectOutputStream because the version of HeaderGroup
that is packaged with android does not implement the Serializable
interface.

Is what I want possible?

What i am trying is putting the implementation of
org.apache.http.message.HeaderGroup in my compilable source tree.  The
code compiles, but when packaging it to be installed on an emulator /
device the Dex target is causing a failure.  Not sure what to do from
here, or how else to get my results, with out writing my own
Serializer.

Thanks in advance for any help.

-- 

3. Problems writing a C2DM service (InstantiationException).

4. Problem

5. apple group

6. Need to rotate Activity in 3D.

7. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.keyStatus/com.keyStatus.keyStatus}: java.lang.SecurityException: No active admin owned by uid 10031 for poli