How to disable back button in android while logging out the application?
Just using this code: If you want backpressed disable, you dont use super.OnBackPressed();
@Override
public void onBackPressed() {
}
You can override the onBackPressed()
method in your activity and remove the call to super class.
@Override
public void onBackPressed() {
//remove call to the super class
//super.onBackPressed();
}
You just need to override the method for back button. You can leave the method empty if you want so that nothing will happen when you press back button. Please have a look at the code below:
@Override
public void onBackPressed()
{
// Your Code Here. Leave empty if you want nothing to happen on back press.
}
Simply override the onBackPressed() method.
@Override
public void onBackPressed() { }
For me just overriding onBackPressed()
did not work but explicit pointing which activity it should start worked well:
@Override
public void onBackPressed(){
Intent intent = new Intent(this, ActivityYouWanToGoBack.class);
startActivity(intent);
}