I think that the solution of TreKing is the best that we can do. But it is 
not nice, because we always must to make persistence interface so that it 
can be serialize / deserialize anytime. 
It means that we cannot use for example CursorAdapter to populate data on 
list because it will not be possible to serialize / deserialize the adapter 
of the list.
I'm also stuck on this problem (cf. 
http://stackoverflow.com/questions/12673712/onrestoreinstancestate-of-simplecursorapdater)



On Friday, June 29, 2012 9:03:37 PM UTC+2, TreKing wrote:
>
> On Sun, Jun 24, 2012 at 8:10 AM, StSch 
> <[email protected]<javascript:>
> > wrote:
>
>> I am a bit stuck. It's a pretty simple example, the checkbox's event
>> handler adds one button to the layout. I change the screen orientation
>> and the button disappears. The button that was added to the layount in
>> the onCreate()-method remains on the screen. What's the difference?
>>
>
> The difference is one is add in onCreate, which is called again when the 
> Activity is recreated, and the other is called dynamically on click of a 
> button, which of course does not get called again.
>
> My layout changes heavily in the event listeners and it would be very 
>> time-consuming and tiring to save the state and restore it again.
>>
>
> Unfortunately, that's how it's done. Either that or handle the 
> configuration changes yourself, which is a whole other can of worms. 
>
> What I would do is have a business model object that describes your UI. 
> Instead of modifying your UI on clicking a button, you update your model 
> and build your UI off of that. When you change configuration, persist the 
> model (as a Bundle, as a static, whatever) and recreate your UI from it as 
> necessary.
>
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago 
> transit tracking app for Android-powered devices
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to