javaandroidandroid-picture-in-picture

How to detect if user drag PIP window (drag down to dismiss)?


What i need to do is detect if user drag down the PIP window (drag down to dismiss). When I do so, the onPictureInPictureModeChanged method is called

but how can i detect the dismiss specifically?


Solution

  • Whenever user drag to dismiss the PIP window onStop() is called.

    just add these lines.

     @Override
    protected void onStop() {
        //your code here
        player.release();
        super.onStop();
        Log.v(TAG, "onStop()...");
    }