Android:MainActivity突然在不同的活动中再次创建,而没有被调用?

Android:MainActivity突然在不同的活动中再次创建,而没有被调用?,android,android-activity,Android,Android Activity,我面临着一种奇怪的行为。我从我的main活动中开始一个新的活动B,使用 Intent mIntent = new Intent(this, ActivityB.class); mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //tried addFlags as well startActivity(mIntent); 突然(10-45秒之间),突然main活动又开始了,没有任何原因。在Logcat中,我看到正在再次创建MAIN活动,并收到了

我面临着一种奇怪的行为。我从我的
main活动中开始一个新的
活动B
,使用

Intent mIntent = new Intent(this, ActivityB.class);
mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);  //tried addFlags as well
startActivity(mIntent);
突然(10-45秒之间),突然
main活动
又开始了,没有任何原因。在Logcat中,我看到正在再次创建
MAIN活动
,并收到了intent
android.intent.action.MAIN

更奇怪的是,如果我以同样的方式启动另一个
ActivityC
,它工作正常,不会跳回主活动

有人有什么想法吗

Logcat

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() -> 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
Manifest.xml

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:launchMode="singleTop"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>      
    </activity>

    <activity android:name=".ActivityB"
        android:label="@string/app_name"
        android:launchMode="singleTop"
        android:screenOrientation="portrait">
    </activity>

删除启动模式或将其添加到所有活动中,您总是将主活动推到其他活动之上
编辑:我没看到你做了那件事,真奇怪。。最后我发现,我使用的是一个
CustomTextView
,它将文本倾斜成一个大位图。。。由于另一个解决方案,我删除了此选项,现在
main活动
不再启动。。。似乎我的观点因为某种原因被扼杀了,但我的日志中没有任何错误。。。至少它现在起作用了……

如果你去C,你也会使用标志吗?是的,这和启动ActivityB是一样的。这就是为什么我很困惑。。。顺便说一下,每个活动的启动模式都设置为singleTop。。