How to disable back button in android while logging out the application?
If looking for a higher api level 2.0 and above this will work great
@Override
public void onBackPressed() {
// Do Here what ever you want do on back press;
}
If looking for android api level upto 1.6.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
//preventing default implementation previous to android.os.Build.VERSION_CODES.ECLAIR
return true;
}
return super.onKeyDown(keyCode, event);
}
Write above code in your Activity to prevent back button pressed