App completely restarting when launched by icon press in launcher

前端 未结 14 1965
灰色年华
灰色年华 2020-11-29 03:02

I\'m in the process of trying to make a release build of my first android app to send to a few testers. However, I ran into a problem with it. When you exit the app and then

相关标签:
14条回答
  • 2020-11-29 03:54

    I had the same problem with an application and I resolved this behavior adding flag "android:launchMode="singleTop"" instead of "android:launchMode="singleTask"" in the <activity> declaration of your AndroidManifest.xml file. Hope this will help somebody.

    0 讨论(0)
  • 2020-11-29 03:54

    You can try to set android:alwaysRetainTaskState="true" for your launcher activity in AndroidManifest.xml.

        <activity
            android:name=".YourMainActivity"
            android:alwaysRetainTaskState="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    

    For details you can see https://developer.android.com/guide/topics/manifest/activity-element.html#always

    0 讨论(0)
提交回复
热议问题