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- Android SDK Preview N 51- Android Build Tools v23.0.0 52- Android Support Repository 53 54Screenshots 55------------- 56 57<img src="screenshots/main.png" height="400" alt="Screenshot"/> 58 59Getting Started 60--------------- 61 62This sample uses the Gradle build system. To build this project, use the 63"gradlew build" command or use "Import Project" in Android Studio. 64 65Support 66------- 67 68- Google+ Community: https://plus.google.com/communities/105153134372062985968 69- Stack Overflow: http://stackoverflow.com/questions/tagged/android 70 71If you've found an error in this sample, please file an issue: 72https://github.com/googlesamples/android-MultiWindowPlayground 73 74Patches are encouraged, and may be submitted by forking this project and 75submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 76 77License 78------- 79 80Copyright 2016 The Android Open Source Project, Inc. 81 82Licensed to the Apache Software Foundation (ASF) under one or more contributor 83license agreements. See the NOTICE file distributed with this work for 84additional information regarding copyright ownership. The ASF licenses this 85file to you under the Apache License, Version 2.0 (the "License"); you may not 86use this file except in compliance with the License. You may obtain a copy of 87the License at 88 89http://www.apache.org/licenses/LICENSE-2.0 90 91Unless required by applicable law or agreed to in writing, software 92distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 93WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 94License for the specific language governing permissions and limitations under 95the License. 96