Note that there are some explanatory texts on larger screens.

plurals
  1. POActivity be killed when press HOME only in release mode
    text
    copied!<p>First, I have two activities: Splash and MainActivity ( only support portrait). In MainActivity, I have many fragments use Slide menu. I want to keep current fragment when user leave MainActivity. Here is my try:</p> <pre><code> int currentFragment = 0; public void onCreate(Bundle savedInstanceState) { if (savedInstanceState != null) { currentFragment = savedInstanceState.getInt(CURRENT_FRAGMENT_KEY, 0); switchContent(currentFragment); } else { // change fragment by index switchContent(0); } } @Override protected void onSaveInstanceState(Bundle outState) { outState.putInt(CURRENT_FRAGMENT_KEY, currentFragment); Log.d("onSaveInstanceState" ," current fragment" + currentFragment); super.onSaveInstanceState(outState); } </code></pre> <p>My <code>manifest</code>:</p> <pre><code> &lt;activity android:name="com.appiphany.auskills.activity.SplashActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".activity.MainActivity" android:screenOrientation="portrait" /&gt; </code></pre> <p>Everything is fine when I build my app with debug key: press Home button, then back to the app, it open previous fragment. But when I build on release mode (use my private key, I don't use <code>proguard</code>), press HOME button in MainActivity, then open app again, <strong>it starts from SplashActivity</strong>. I have no idea with this strange issue. I event try this one but it doesn't help:</p> <pre><code> @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); currentFragment = savedInstanceState.getInt(CURRENT_FRAGMENT_KEY, 0); switchContent(currentFragment); } </code></pre> <p>Is there any ideas?</p> <p><strong>Update</strong>: I found another strange one: this issues only occurred when I install it from apk file. After install, phone will ask 2 options: <code>Done</code> or <code>Open</code>. If I press <code>open</code>, this issues happened. When I kill app by task manager, then open again, it work correctly. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload