我是用我的活动moveTaskToBack()方法。
当我是pressing后退按钮的活动仍是可见的。 BACK键不起作用。我做了什么错在这里?我想导航回到previous活动。
公共无效onBack pressed(){
// TODO自动生成方法存根
moveTaskToBack(真正的);
新的终结()killApp(假);
super.onBack pressed();
}
解决方案
moveTaskToBack的目的:
http://developer.android.com/reference/android/app/ Activity.html
moveTaskToBack(布尔非root)
移到含有该活动到活动堆后面的任务
你可以做的是:
公共无效onBack pressed(){
// TODO自动生成方法存根
moveTaskToBack(真正的); //我不认为你正在寻找这一点。
新的终结()killApp(假); //无论这一点。
super.onBack pressed();
}
也许这样的:安卓:回到previous活动
一些在类似的 onBack pressed()
在 super.OnBack pressed();
另外,还要确保当你打你的后退按钮,你真的要在这个方法中。
I am using moveTaskToBack() method in my activity.
When I am pressing back button the activity still is visible. The back key does not work. What did I do wrong here? I want to navigate back to the previous activity.
public void onBackPressed() {
// TODO Auto-generated method stub
moveTaskToBack(true);
new Finalizer().killApp(false);
super.onBackPressed();
}
解决方案
The purpose of moveTaskToBack:
http://developer.android.com/reference/android/app/Activity.html
moveTaskToBack(boolean nonRoot)
Move the task containing this activity to the back of the activity stack.
What you could do is:
public void onBackPressed() {
// TODO Auto-generated method stub
moveTaskToBack(true); // I don't think you're looking for this.
new Finalizer().killApp(false); // Neither this.
super.onBackPressed();
}
Maybe this: Android: Go back to previous activity
Something similar in your onBackPressed()
after super.OnBackPressed();
Also make sure when you're hitting your back button, you're actually going in this method.