• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps problems with swithcing from portrait to landscape

Hi all,
in my code ,in the same activity , i am changing the view ,using LayoutInflaters (adding another xml file with another view ),whenever a button click happens .

My problem is whenever the mobile switching from portrait to landscape or landscape to portrait ,the activty is started from the onCreate method ,so the previous view is disappearing (like whenever i click the button one another view added ,that view is disappearing ).

SO ,how to avoid this ,i.e.wherever the orientation changes from there only the activity should start.

If any body knows pls give me reply ,it is giving me a lot of problems .

Murali dhuli
android developer
 
Can you set your view to a class member and check if it already exists in onCreate, and if not create it and set it to the variable?

I haven't tried this but it seems to make sense to me heh :)
 
Back
Top Bottom