Reputation: 6033
Is there a way to avoid the activity recreation when changing over to a picture in picture window?
Basically I call it like this:
@Override
protected void onUserLeaveHint() {
if (Build.VERSION.SDK_INT > 24 && isInFullscreen) {
MainActivity.this.enterPictureInPictureMode();
}
super.onUserLeaveHint();
}
The activity always reloads, which results into longer waiting times.
Upvotes: 1
Views: 1470
Reputation: 93542
From the docs- add this to the activity in your manifest:
android:resizeableActivity="true"
android:supportsPictureInPicture="true"
android:configChanges=
"screenSize|smallestScreenSize|screenLayout|orientation"
See https://developer.android.com/guide/topics/ui/picture-in-picture.html for more detail
Upvotes: 4