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