假设应用程序以活动A启动然后从A调用B.then B到C然后从C到D.如果用户按下Home Key则启动D然后从launcheri再次启动应用程序想要从活动A启动应用程序并且如果在B活动用户按下后退按钮app应该关闭。活动A不应该被调用..
答案 0 :(得分:0)
如果你想调用一个你可以使用Intent的活动,它很简单。检查代码
Button button1 = (Button)findViewById(R.id.mybtn);
button1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent myIntent = new Intent(v.getContext(),
RegisterActivity.class);
startActivityForResult(myIntent, 0);
finish();
}
});
这里RegisterActivity.class是你想要调用的活动
答案 1 :(得分:0)
据我所知,你不想再回到活动A.在这种情况下,您需要清除历史堆栈中的活动。在Manifest文件中声明活动时,将noHistory设置为true。见下文。
<activity android:name=".A"
android:noHistory="true"/>
希望这有帮助。