我可以覆盖返回
和家居
按钮(硬件)在 Android的功能
?我的意思是像点击主页按钮应该去家里我的应用程序的屏幕
而不是家手机屏幕
Can i override the functionality of back
and home
buttons(hardware) in android
? i mean like clicking on home button should go tohome screen of my app
instead of home screen of mobile
主页按钮:
=>您不能覆盖的home键的行为。
=> You can't override the behaviour of home button.
返回按钮:
=>为了捕获或覆盖默认后退按钮preSS在安卓以下的onkeydown方法可以通过活动来实现。
=> In order to capture or override the default back button press in Android the following onKeyDown method can be implemented by the Activity.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
moveTaskToBack(true);
return true;
}
return super.onKeyDown(keyCode, event);
}
在案件的Android 2.0+一个说服的方法是作为
In case of Android 2.0+ a convince method is provided as
@Override
public void onBackPressed() {
// implement your override logic here
return;
}