What does attaching uimode to Android: configchanges actually do?

I just fixed the error in our application. The problem is that docking or undocking the device will cause the application to restart. I found this fix after dragging a large number of forum threads. It is to attach uimode to Android: configchanges attribute in androidmanifest.xml file:

    <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustPan">
        <intent-filter android:label="@string/launcher_name">
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

I want to make sure that by submitting this change, I won't destroy other important functions. As far as I know, this can prevent our application from restarting when docking or undocking. But is that all? I can't find any easy to understand documents

resolvent:

Adding some content to Android: configchanges will tell Android that you will handle specific events (or ignore them) in onconfigurationchanged of the activity class. If you specify some content, Android itself will not do anything when the event is triggered. In the case of docking / undocking, this will be the re creation of the activity

In general, as long as you don't change the layout (for example, in the event of such an event), you won't destroy anything

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>