android/media-samples

PictureInPicture sample app keeps crashing.

awesome1128 opened this issue · 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.

Y-E-P commented

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.

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. 💯

Ok