gpt4 book ai didi

java.lang.IllegalStateException : enterPictureInPictureMode: Current activity does not support picture-in-picture

转载 作者:行者123 更新时间:2023-12-03 08:42:11 27 4
gpt4 key购买 nike

错误消息

java.lang.IllegalStateException: enterPictureInPictureMode: Current activity does not support picture-in-picture.
at android.os.Parcel.createException(Parcel.java:2079)
at android.os.Parcel.readException(Parcel.java:2039)
at android.os.Parcel.readException(Parcel.java:1987)
at android.app.IActivityTaskManager$Stub$Proxy.enterPictureInPictureMode(IActivityTaskManager.java:6824)
at android.app.Activity.enterPictureInPictureMode(Activity.java:2728)
at com.MapActivity.enterPIP(apActivity.java:2892)
at com.MapActivity.onUserLeaveHint(MapActivity.java:2915)
at android.app.Activity.performUserLeaving(Activity.java:8015)
at android.app.Instrumentation.callActivityOnUserLeaving(Instrumentation.java:1517)
at android.app.ActivityThread.performUserLeavingActivity(ActivityThread.java:4417)
at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:4402)
at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:46)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.wm.ActivityTaskManagerService.ensureValidPictureInPictureActivityParamsLocked(ActivityTaskManagerService.java:4263)
at com.android.server.wm.ActivityTaskManagerService.enterPictureInPictureMode(ActivityTaskManagerService.java:4140)
at android.app.IActivityTaskManager$Stub.onTransact(IActivityTaskManager.java:3262)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)

我的设置值和代码。

AndroidManifest.xml

...
android:name="com.test.MapActivity"
android:resizeableActivity="true"
android:supportsPictureInPicture="true"
android:configChanges="orientation|smallestScreenSize|screenLayout|screenSize"
android:exported="true"
...

MapActivity.java

public void enterPIP(){
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
...
PictureInPictureParams params = new PictureInPictureParams.Builder()
.setAspectRatio(new Rational(width, height)).build();

...
boolean supportsPIP =
packageManager.hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE);
if (supportsPIP) {
Log.d("PIP", "*** Picture-in-Picture ***");
enterPictureInPictureMode(params);
} else {
Log.d("PIP", "*** No support Picture-in-Picture ***");
}
}
}

调用enterPictureInPictureMode(params)后APP崩溃;

它适用于具有简单按钮的 Activity,但不适用于由复杂元素组成的 MapActivity。

最佳答案

终于找到问题所在了!另一个 Activity 扩展了此 MapActivity。我在AndroidManifest中声明了此 Activity 的PIP配置,它可以工作。 :D

关于java.lang.IllegalStateException : enterPictureInPictureMode: Current activity does not support picture-in-picture,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62402064/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com