Saturday, August 25, 2012

Android: Preventing destroying the activity when changes made by rotation of the device

Preventing destroying the activity when changes made by rotation of the device, use
android:configChanges="orientation"

Example:


<activity
            android:configChanges="orientation"
            android:name=".QuizStartActivity"
            android:label="@string/title_activity_quiz_start" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>