My current code exits application if press double back button and now I want to change it so that it just minimize app on double click. Just like how pressing a home button.
This is the code:
@Override
public void onBackPressed() {
    if (doubleBackToExitPressedOnce) {
        super.onBackPressed();
        return;
    }
    final View coordinatorLayoutView = findViewById(R.id.coordinator);
    Snackbar.make(coordinatorLayoutView, "Press again to minimize app.", Snackbar.LENGTH_LONG).show();
    this.doubleBackToExitPressedOnce = true;
    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            // This is where I need code
            doubleBackToExitPressedOnce = false;
        }
    }, 2000);
}
 
    