I have a TabActivity
that hosts other three activities.
If the first tab is selected, I can change the device orientation and everything is ok.
If I go to the second or the third tab and change the orientation, the tab sub activity's(second and third) onCreate()
method gets called twice, for the first time is setting the default tab content(the first one) and at the second onCreate, is setting the selected tab content(as it should for the first time).
Why is onCreate()
method being called twice and how can I solve the problem?
EDIT:
I don't want to use android:configChanges="orientation"
in the manifest because I want to get the app title and system bar down and on portrait to show them, and this is possible only before setting a content...
I think the best solution is to take a different approach by using a single Activity
and put every tab content in a different LinearLayout
and in onClick()
methods of the tabs(which will be some buttons) to switch between the layouts...
If anybody have a better idea, please post it here!
Thank you!