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