Android: switching screens with new activity or just changing content view

Calling setContentView() multiple times is not recommended. The normal way to switch between layouts in the same activity is to use a ViewFlipper or FrameLayout (see Calling setContentView() multiple times and How can i make a dynamic flipping screen(like that of iPhone) in Android)

Alternatively you could use ViewSwitcher, which seems to fit your needs pretty well. There’s a good detailed tutorial available at http://inphamousdevelopment.wordpress.com/2010/10/11/using-a-viewswitcher-in-your-android-xml-layouts/

Leave a Comment