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