On Thu, Sep 2, 2010 at 1:39 PM, Doug Gordon <[email protected]> wrote:
> My users will want to toggle between two different "presentations" of
> their current data selection, with differing layouts. I want to handle
> this part of the app in a single activity, so am thinking of simply
> calling setContentView to change the layout and then of course fill in
> the data accordingly.
>
> Are there any drawbacks with this approach?

You keep destroying and recreating widgets, plus having to fire all
the code to get event listeners and such set up again.

I would recommend ViewFlipper or ViewSwitcher instead.

> Also, exactly when does the window get redrawn in
> this case? When the method that does the work (i.e., an event
> callback) returns?

Effectively, yes. The drawing operations are put on a message queue
that will be processed again once you return control of the main
application thread to Android.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Consulting: http://commonsware.com/consulting

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