-6
我想做幾件事情,如果用戶按Home按鈕,我的代碼不起作用。想要做幾件事情,如果用戶按下主頁按鈕
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if(keyCode==KeyEvent.KEYCODE_HOME)
{
Toast.makeText(this, "Click Home ", Toast.LENGTH_LONG).show();
}
return super.onKeyDown(keyCode, event);
}
的[檢測在Android主按鈕按下]可能重複(http://stackoverflow.com/questions/8881951/detect-home-button-press-in-android) –