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