Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: MainActivity is suddenly created again in different Activity without being called?
    text
    copied!<p>I m facing a weird behaviour. I start a new <code>Activity B</code> from within my <code>MainActivity</code> with </p> <pre><code>Intent mIntent = new Intent(this, ActivityB.class); mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //tried addFlags as well startActivity(mIntent); </code></pre> <p>Suddenly (between 10-45seconds), suddenly the <code>MainActivity</code> is starting again, without any reason. In Logcat, I see that the <code>MainActivity</code> is being created again (not even resumed), and received the intent <code>android.intent.action.MAIN</code></p> <p>Even more weird is, if I start another <code>ActivityC</code>, in the same way, it's working fine and not jumping back to the MainActivity...</p> <p>Anyone any ideas?</p> <p>Logcat</p> <pre><code>05-21 15:35:13.897: D/dalvikvm(14312): GC_FOR_ALLOC freed 8K, 6% free 18231K/19356K, paused 33ms, total 33ms 05-21 15:35:13.936: D/dalvikvm(14312): GC_CONCURRENT freed 17K, 6% free 18213K/19356K, paused 2ms+5ms, total 33ms 05-21 15:35:14.108: D/dalvikvm(14312): GC_FOR_ALLOC freed 71K, 6% free 18235K/19356K, paused 25ms, total 26ms 05-21 15:35:14.123: I/dalvikvm-heap(14312): Grow heap (frag case) to 27.696MB for 10342416-byte allocation 05-21 15:35:14.155: D/dalvikvm(14312): GC_FOR_ALLOC freed 0K, 4% free 28335K/29460K, paused 24ms, total 24ms 05-21 15:35:14.178: D/dalvikvm(14312): GC_CONCURRENT freed 1K, 4% free 28334K/29460K, paused 3ms+5ms, total 28ms 05-21 15:35:14.780: I/Choreographer(14312): Skipped 58 frames! The application may be doing too much work on its main thread. 05-21 15:35:23.623: D/dalvikvm(14312): GC_FOR_ALLOC freed 5879K, 18% free 28729K/34636K, paused 35ms, total 36ms 05-21 15:36:00.037: D/dalvikvm(14312): GC_CONCURRENT freed 6198K, 18% free 29094K/35320K, paused 7ms+14ms, total 92ms //above, is the last result, before MainActivity is starting again 05-21 15:37:28.498: I/MainActivity(15078): onCreate() -&gt; android.intent.action.MAIN 05-21 15:37:28.623: D/dalvikvm(15078): GC_FOR_ALLOC freed 65K, 2% free 8901K/8996K, paused 44ms, total 45ms </code></pre> <p>Manifest.xml</p> <pre><code> &lt;activity android:name=".MainActivity" android:label="@string/app_name" android:launchMode="singleTop" android:screenOrientation="portrait"&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=".ActivityB" android:label="@string/app_name" android:launchMode="singleTop" android:screenOrientation="portrait"&gt; &lt;/activity&gt; </code></pre>
 

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