我有奇怪的HOME按钮问题。 我有两个活动A和B.活动结束于HOME按钮
一个永远了B ......这样的:
startActivityForResult(new Intent("com.test.B"), 0);
,并聆听结果为完成整个应用程序...但我觉得无所谓。
当我在B活动,并点击HOME按钮...和长按HOME按钮回来。 显示活动A而不是B ...
为什么会发生这种情况?任何想法?我应该在Manifest中设置一些东西吗? 它看起来像活动B完成了......但我不想这样。我要做个B所示...
下面是某活动的一些代码:
// Start new activity
Intent intent = new Intent(getApplicationContext(),B.class);
startActivityForResult(intent, 0);
这里是明显的一些代码:
<activity
android:label="A"
android:name=".A"
android:screenOrientation="portrait" >
<intent-filter >
<action android:name="com.uno_manager.A" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:label="B"
android:name=".B"
android:noHistory="true"
android:screenOrientation="portrait" >
<intent-filter >
<action android:name="com.uno_manager.B" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
我那些之前有活动一个活动两个......代表启动画面。
在活动B中,我重写了onRestoreInstance
和onInstanceSave
方法。然后点击一下即可拨打setResult
和finish()
退出应用程序。但我认为这与此无关。
我试着评论B活动的整个代码。我只在onCreate
方法中只留下了setContentView
。同样的事情发生在HOME按钮上。
您可以添加代码吗? – 2012-04-15 13:44:18
有趣的是,我创建了一个测试项目,并尝试过但为我工作?不同的是我尝试像这样: 'Intent intent = new Intent(); intent = new Intent(this,Test2.class); startActivityForResult(intent,0);' – 2012-04-15 13:54:46