media-samples icon indicating copy to clipboard operation
media-samples copied to clipboard

PictureInPicture sample app keeps crashing.

Open awesome1128 opened this issue 4 years ago • 3 comments

Hi Yaraki. Nice to meet you. You're doing a great jobs. I saw your repositories, so it's amazing. I have one issue now. When I try to run your PIP sample app on android emulator, app keeps crashing. Could you please guide me? I am waiting for your positive response. Thank you.

awesome1128 avatar Aug 06 '21 20:08 awesome1128

Hi @awesome1128 Just write check for nullable, because getWindowInsetsController method used for platform 30(or, as I correctly understand, for other versions which supported insets) for make immersive full screen.

private void adjustFullScreen(Configuration config) {
        final WindowInsetsControllerCompat insetsController =
                ViewCompat.getWindowInsetsController(getWindow().getDecorView());
        if(insetsController == null) return;
      ...
    }

Update: You can use WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView()); and it already prepared to handle insets on all Android API.

Y-E-P avatar Sep 15 '21 08:09 Y-E-P

Hi @awesome1128 Just write check for nullable, because getWindowInsetsController method used for platform 30(or, as I correctly understand, for other versions which supported insets) for make immersive full screen.

private void adjustFullScreen(Configuration config) {
        final WindowInsetsControllerCompat insetsController =
                ViewCompat.getWindowInsetsController(getWindow().getDecorView());
        if(insetsController == null) return;
      ...
    }

Update: You can use WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView()); and it already prepared to handle insets on all Android API.

Great! A PR would be better. :100:

sanbrother avatar Oct 29 '21 02:10 sanbrother

Ok

73alex avatar Jul 29 '22 21:07 73alex