In my application i want to exit the application when clicking the back button.When first time entered into the app when clicking back from this screen means it is exiting.But if i got to next screen and coming back to this screen and clicking back means going to previous screen not exiting.Thanks in advance..
My code:
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (keyCode == KeyEvent.KEYCODE_BACK)
{
finish();
java.lang.System.exit(0);
}
return super.onKeyDown(keyCode, event);
}