1 2Android MultiWindowPlayground Sample 3=================================== 4 5This sample demonstrates the use of the multi-window API available 6in Android N. It shows the use of new Intent flags and 7AndroidManifest properties to define the multi-window behavior. 8Switch the sample app into multi-window mode to see how it affects 9the lifecycle and behavior of the app. 10 11Introduction 12------------ 13 14Android N introduces new APIs to support multiple activities 15to be displayed at the same time. 16 17Activities that are started within the same task stack 18inherit their multiwindow properties from the activity that fired 19off the intent. The following features are available when an activity 20has been launched into a new task stack. 21 22An activity can be set as not resizable through the 23`android:resizableActivity` property in the AndroidManifest. All 24applications targeting Android N or above are resizable by default. 25 26In split-screen mode, an activity can be started adjacent to the 27launching activity by setting the 28`Intent.FLAG_ACTIVITY_LAUNCH_TO_ADJACENT` flag in its intent. 29 30Sometimes activities may choose to handle configuration changes 31themselves (for example for games or OpenGL-based applications). In this 32case, setting 33`android:configChanges=screenSize|smallestScreenSize|screenLayout|orientation` 34in the AndroidManifest definition of the activity enables callbacks for 35all configuration changes that may occur during multi-window use for the 36Activity. See [Handling Runtime Changes][1]. 37 38In freeform mode (where applications can be freely resized), activities 39can be started within a certain area of the screen using the 40`ActivityOptions#setLaunchBounds` call. 41 42Alternatively, the preferred and minimum sizes can be set in a new 43`layout` property in the AndroidManifest. 44 45 46[1]: https://developer.android.com/guide/topics/resources/runtime-changes.html 47 48Pre-requisites 49-------------- 50 51- Android SDK 24 52- Android Build Tools v28.0.3 53- Android Support Repository 54 55Screenshots 56------------- 57 58<img src="screenshots/main.png" height="400" alt="Screenshot"/> 59 60Getting Started 61--------------- 62 63This sample uses the Gradle build system. To build this project, use the 64"gradlew build" command or use "Import Project" in Android Studio. 65 66Support 67------- 68 69- Google+ Community: https://plus.google.com/communities/105153134372062985968 70- Stack Overflow: http://stackoverflow.com/questions/tagged/android 71 72If you've found an error in this sample, please file an issue: 73https://github.com/googlesamples/android-MultiWindowPlayground 74 75Patches are encouraged, and may be submitted by forking this project and 76submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 77 78License 79------- 80 81Copyright 2019 The Android Open Source Project, Inc. 82 83Licensed to the Apache Software Foundation (ASF) under one or more contributor 84license agreements. See the NOTICE file distributed with this work for 85additional information regarding copyright ownership. The ASF licenses this 86file to you under the Apache License, Version 2.0 (the "License"); you may not 87use this file except in compliance with the License. You may obtain a copy of 88the License at 89 90http://www.apache.org/licenses/LICENSE-2.0 91 92Unless required by applicable law or agreed to in writing, software 93distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 94WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 95License for the specific language governing permissions and limitations under 96the License. 97