JosephT
JosephT

Reputation: 865

Android: Activity restarted when turn off wifi in setting

I have added android:configChanges in Manifest, when I change font size or turn off Wifi, the activity will be restarted automatically. Is there any way I can prevent this restarts ?

Thanks for the help.

    <activity android:name="com.example.MainActivity" android:theme="@style/SkoletubeTheme"
                android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
                android:launchMode="singleTask"
              android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Upvotes: 0

Views: 221

Answers (1)

Satyaki Mukherjee
Satyaki Mukherjee

Reputation: 2879

You have already caught the exception. It's happen for android:configChanges . Please remove unnecessary values from android:configChanges. Only keeps orientation .

I think your problem will be solved. Try this and let me know if it's acceptable or not.

Upvotes: 1

Related Questions