How to handle recent apps navigation button in android studio?

454 Views Asked by At

I have a NavigationView in my app. I want to open the NavigationView when resent apps navigation button is clicked. I tried this:

@Override
    protected void onPause () {
        if(!(drawer.isDrawerOpen(GravityCompat.START))){
            drawer.openDrawer(GravityCompat.START);
        } 
        super.onPause();
    }

But it opened recent apps and NavigationView together. Is there any way to open NavigationView when recent app button is clicked?

1

There are 1 best solutions below

0
CommonsWare On

I tried this

onPause() is not unique to your desired scenario. There are many things that trigger onPause(), including system HOME navigation and configuration changes (e.g., screen rotation).

Is there any way to open NavigationView when recent app button is clicked?

No:

  • There may not be such a button, such as on the millions of devices that use gesture navigation

  • Apps are not informed about when that button gets clicked

  • Apps cannot interfere with the operation of that button