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?

Thanks,

Kirk
--~--~---------~--~----~------------~-------~--~----~



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
onCreate()



--~--~---------~--~----~------------~-------~--~----~


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
something.

Kirk




--~--~---------~--~----~------------~-------~--~----~



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 <kirk.mora...@gmail.com>




--~--~---------~--~----~------------~-------~--~----~



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
hack...@android.com

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. Developer impressions and lessons learned from iPhone App Store launch

JP,

This was really useful. Thanks.






-- 
take care,
Muthu Ramadoss.

http://cookingcapsules.com - nourish your droid.
http://mobeegal.in - find stuff closer.

--~--~---------~--~----~------------~-------~--~----~

2. WebView supports multipart/related?

Does WebView support multipart/related content type?

If it does, does it support binary encoded entity?

Answers will be very appreciated!!!!!!!

--~--~---------~--~----~------------~-------~--~----~

3. troubleshooting

4. HOWTO: SimpleCursorAdapter with custom row display

5. Final SDK build available (84853); deadline extended to Tuesday, August 5?????

6. Anyone have packages android.net & java.net???

7. Developer impressions and lessons learned from iPhone App Store launch