如何检测消防电视应用程序何时最小化?
How to detect when a fire tv application is minimized?
有没有办法检测用户何时通过按遥控器上的主页图标最小化了 Fire TV 应用程序?
No there is no key event to detect the Home button key press but u can
check for onStop method of the activity and where u can add additional
condition whether backkey pressed or not as its always called before
onStop().
boolean flag=false;
@Override
public void onBackPressed() {
super.onBackPressed();
flag=true;
}
@Override
protected void onStop() {
super.onStop();
if(flag){
//back button pressed
}
else{
// Home button pressed
}
}
有没有办法检测用户何时通过按遥控器上的主页图标最小化了 Fire TV 应用程序?
No there is no key event to detect the Home button key press but u can check for onStop method of the activity and where u can add additional condition whether backkey pressed or not as its always called before onStop().
boolean flag=false;
@Override
public void onBackPressed() {
super.onBackPressed();
flag=true;
}
@Override
protected void onStop() {
super.onStop();
if(flag){
//back button pressed
}
else{
// Home button pressed
}
}