Android: Stop Recreating The Activity On Orientation Change
I have a listview with two buttons in my main.xml layout. On click of one button i'am creating a textview dynamically and adding it at the bottom of the screen to confirm the user
Solution 1:
Just edit the Activity Tag in androidmanifest.xml.
<activityandroid:configChanges="keyboardHidden|orientation"android:name=".testActivity"android:label="@string/app_name"></activity>
Solution 2:
You should add screenSize
if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device).
Added in API level 13.
then it should be like this
<activityandroid:configChanges="keyboardHidden|orientation|screenSize"android:name=".testActivity"android:label="@string/app_name"></activity>
http://developer.android.com/guide/topics/manifest/activity-element.html
Post a Comment for "Android: Stop Recreating The Activity On Orientation Change"