Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preserving the state of ActivityGroup's child activities on screen rotation [duplicate]

I have an ActivityGroup inside a tab of the TabHost, and that ActivityGroup has multiple child activites.

When device is rotated the tab doesn't preserve it's state (I'm aware that on orientation changes activities are restared).

What is the best practice to keep the state of the ActivityGroup's child activity that was shown before the screen rotation?

Note that I may need to keep the states of every child activity of the ActivityGroup.

like image 979
smukov Avatar asked Nov 04 '22 02:11

smukov


1 Answers

I used the following in the AndroidManifest to save the views from beeing destroyed but it did not work:

 android:configChanges="orientation"

I just solved my problem by changing in the AndroidManifest.xml this line :

<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="15" />

to

<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="11" />

Seems like my environment had trouble with a different target version as it recognized and added it automaticaly.

like image 193
Optimus Avatar answered Nov 09 '22 15:11

Optimus