I need functionality to exit from the complete application while pressing back button. currently i have a script that ask to press twice to exit application,
in that it finish the current activity but does not exits from application old visited activities are remain same. here is my code that i am using.
int i = 1;
@Override
public void onBackPressed() {
if (i == 1) {
Toast.makeText(getApplicationContext(), "Press back once more to exit.", Toast.LENGTH_SHORT).show();
} else if(i>1) {
finish();
}
i++;
}