Persistant Variables

by Kirk » Tue, 14 Apr 2009 02:27:28 GMT

Sponsored Links
 I have an activity that responds to the accelerometer. When the device
is rotated, a different layout is displayed based on whether the phone
is portrait or landscape. I notice, however, that each time the phone
is rotated, the onCreate method is called and all of my instance
variables are reset. Is there any way to make the values of these
variables persists?



Persistant Variables

by MrChaz » Tue, 14 Apr 2009 02:32:11 GMT

 Take at look at on onSaveInstanceState()
You can use that to save things into the bundle that is passed to


Sponsored Links

Persistant Variables

by Kirk - Actual Metrics » Tue, 14 Apr 2009 04:07:27 GMT

 Thanks that works great. I feel kind of stupid for not figuring that
out on my own now.  I do think it's silly for onCreate to be called
again on rotate; there should be an onOrientationChange event or



Persistant Variables

by MrChaz » Tue, 14 Apr 2009 04:26:32 GMT

 I think that there is a permission for saying that you will handle it
and another event that you can hook.
But I've not explored those :)

On Apr 13, 8:49pm, Kirk - Actual Metrics <>


Persistant Variables

by Dianne Hackborn » Tue, 14 Apr 2009 05:54:02 GMT

 The docs explain why it works the way it does.

On Mon, Apr 13, 2009 at 12:49 PM, Kirk - Actual Metrics <

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


Other Threads

1. Get body movement (e.g. turn around)

I'm working on an app that needs body movements as inputs. So
basically I want to know if a person turns around completely (360).
If a the person does sthg happens inside the application. My problem
for now is: How to figure out if a person turned around?
I don't see an approach with gps as the person is not moving enough.
So I thought about the compass or acceleration sensor but I have no
clue how to manage that. I'd really appreciate some ideas / hints /




2. SMS text garbled using native Messaging app when message spans two text messages?


I'm working with the sms intent. Testing this on 2.0 emulators.

If I use the built-in messaging app to create a text message which
spans two messages, the receiving emulator displays the received
message as garbled text. Looks like it's encoded or compressed etc.
Does anyone else see this? Is this just an issue with the emulators,
and won't happen on a real device? If I send a message < 160
characters, the other emulator gets it ok.



3. Debugging on mobile 2

4. Droid/Milestone: GL_OES_framebuffer_object reported but not working

5. AES decryption is slow....

6. Mohon gabung ..

7. twtpic4j is not throwing exception