Android:如何切换到已创建的“活动" [英] Android: How to switch to Activity that has already been created
本文介绍了Android:如何切换到已创建的“活动"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Android编程的新手. 我要做的是将另一个活动创建完毕. 假设我启动了活动B,然后从活动A移至活动B,然后按了后退按钮,然后又移回活动A. 现在,我想在完成倒数计时器后切换到活动B.
I'm new to Android programming. What I want to do is to swith to an another activity that has already been created. Suppose I started Activity B and move from Activity A to Activity B, and then I pressed back button and move back to Activity A. Now I want to switch to Activity B when a countdown timer is done.
ActivityA.java
private void startTimer() {
...
@Override
public void onFinish() {
// force the user to move on to Activity B
// if the user haven't started Activity B, just start it
if (!mHasActivityBStarted) {
Intent intent =
new Intent(ActivityA.this, ActivityB.class);
startActivity(intent);
} else {
// how can I switch to ActivityB that has been created?
}
}
}.start();
}
我该怎么办?
推荐答案
查看全文