是否有可能在移动后台应用程序时,我们的Android点击设备后退按钮?
Is it possible to move the app in background when we click on device back button in android?
背景从那里启动意味着应用程序移动到屏幕(应用程序)?
background means application moves to screen(application) from where it launches ?
我将preFER使用低于code键移动在后台应用
I will prefer to use below code to move application in background
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
switch(keyCode)
{
case KeyEvent.KEYCODE_BACK:
if(isTaskRoot()) {
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
homeIntent.addCategory(Intent.CATEGORY_HOME);
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(homeIntent);
return true;
}
else {
super.keyDown(keyCode,event);
return false;
}
default:
super.keyDown(keyCode,event);
return false;
}
}