为什么我的后退按钮在谷歌地图活动中不起作用? 已经包括:
@Override
public void onBackPressed() {return;}
但仍然无效。
答案 0 :(得分:2)
你需要这个:
@Override
public void onBackPressed() {
super.onBackPressed();
}
或者这个API级别5:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK) {
// your implementation here
// finish(); - to exit the Activity
return true; // shows you consumed the event with your implementation
}
return super.onKeyDown(keyCode, event);
}
答案 1 :(得分:1)
写
super.onBackPressed();
或
this.finish();
而不是返回;