Android-o starts on the secondary display

When I try to start the activity intention, the new activityoptions setlaunchdisplayid (int launchdisplayid) function in android-o always seems to crash my application

When I start an activity from my own application and when I try to start another application (i.e. chrome Canary)

Who knows if this is a general problem with the new API or if I missed something:

A small part of my code is as follows:

options.setlaunchdisplayId(1); startActivity(intent,options);

Note that I'm using 'simulate second screen' for testing (@ 1080p, if important)

Update I tried the ADB command ADB shell start com.chrome.canary – display 1, and the message I got was:

resolvent:

I connect to the second screen through the new API. Here is the code, but there is no way to interact with it

 Bundle bdl;
            MediaRouter mediaRouter = (MediaRouter) mContext.getSystemService(Context.MEDIA_ROUTER_SERVICE);
            MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
            if (route != null) {
                Display presentationDisplay = route.getPresentationDisplay();
                bdl = ActivityOptions.makeClipRevealAnimation(mView, left, top, width, height).setLaunchBounds(rect).setlaunchdisplayId(presentationDisplay.getDisplayId()).toBundle();
                Bundle optsBundle = true ? bdl : null;
                Intent intent = new Intent(mContext, SecondaryActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                mContext.startActivity(intent, optsBundle);
            }

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>