I have an app and I want to do that when user touch back button a Toast show "press back again to exit" but i have problem with this part. on this code, when touch back button app completely finish without toast and touch back button again. Please help me.
public void onStop(){
super.onStop();
if(key == 1){
key =0;
finish();
}else{
Toast.makeText(getApplicationContext(), "press back Button again to exit", Toast.LENGTH_SHORT).show();
key++;
}
return;
}