I have an activity in which I have implemented onBackPressed method and in this method I have implemented code for "Press again to exist".what I want when user press agin to exist I don't want app to exist I want to run app in background.
How can I do that please tell me solution.

here is my code:-

```
@Override
public void onBackPressed() {
    if (doubleBackToExitPressedOnce) {
        super.onBackPressed();
        return;
    }
    this.doubleBackToExitPressedOnce = true;
    Toast.makeText(this, "Press again to exit", Toast.LENGTH_SHORT).show();
    new Handler().postDelayed(new Runnable() {

        @Override
        public void run() {
            doubleBackToExitPressedOnce = false;

        }
    }, 2000);
}

```