//按后退键返回键回主菜单
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
startActivity(new Intent(getApplicationContext(),MainActivity.class));
return true;
}
return false;
}
转载于:https://www.cnblogs.com/jetereting/p/4695507.html