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