This tutorial will show you how to handle when a user press the Back key.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
// IF CLICK BACK BUTTON
if (keyCode == KeyEvent.KEYCODE_BACK)
{
//INSTRUCT WHAT HAPPEN HERE
return true;
}
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
// IF CLICK BACK BUTTON
if (keyCode == KeyEvent.KEYCODE_BACK)
{
//INSTRUCT WHAT HAPPEN HERE
return true;
}
return super.onKeyDown(keyCode, event);
}
1 comment:
Hey thanks for the code. It will very helpful to me in future. This post is related with what I’m concerned with and it’s fantastically made.
Post a Comment