Reference:
http://stackoverflow.com/questions/5312334/how-to-handle-back-button-in-activityCode snippet:
For API level 5@Override
public void onBackPressed() {
// your code.
}
For older then API 5 use this:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// your code
return true;
}
return super.onKeyDown(keyCode, event);
}
沒有留言:
張貼留言