Reputation: 51
I get this toast message on the emulator and device when trying to launch a new activity from my initial one on a secondary display. From my understanding this is a newer feature with Android O. I've searched thoroughly but could not find this problem anywhere else thus I am here. I understand this can be done with presentations but I need to getting it working with activities. Could someone tell me why this occurs?
Upvotes: 5
Views: 3161
Reputation: 15042
Android does support launching an Activity to a secondary display via code (initiating via an adb command not required). Here is an example:
ActivityOptions options = ActivityOptions.makeBasic();
options.setLaunchDisplayId(d.getDisplayId());
Intent secondIntent = new Intent(this, SecondActivity.class);
secondIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(secondIntent, options.toBundle());
If you are seeing a toast message with the error that it is not supported then in your AndroidManifest.xml
add the resizeableActivity="true"
property to your activity like so:
<activity
android:name=".SecondActivity"
android:label="@string/app_name"
android:resizeableActivity="true"
>
Upvotes: 3
Reputation: 11
Android O does not support start activity on the second display except using the "am stack start " command, do you use this to launch activity to the second display?
From the android source code, the warning toast is shown when we tried to put a non-resizeable task on a secondary display with config different from global config.
Maybe you can use the "am task resizeable [0|1|2|3]" commands to make the task resizeable.
Upvotes: 0