Multi Window Android 7.0

Google recently released Android 7.0 or Android Nougat, many new features were released with this on of them was Multi Window Support, cool right more than one app at the same time. So now you can chat as well as read something without switching between apps which in some way was frustrating for me.

So let’s see what is changed from development prospect.

The biggest relief for developers is that Multi Window doesn’t affect the life-cycle of activity. Activity the user has interacted with recently is active at a time, other activities are in paused state even though they are visible. If user interact with such paused activity then it becomes the topmost activity(active one) and the topmost goes to paused state(note only paused not hidden it would still be visible).

Note:  As now the activity which as paused is still visible so we have to keep in mind what code  is handled in onPause() and onStop(). For example now if one of your app is playing video then it must continue playing it even activity is paused(as it is still visible), so now we must not stop the video in onPause() and the code for that should be moved to onStop().

The handling multi window is same as Handling Runtime Changes. So when app resizes we have to handle it the same way we handle runtime changes.

App Configuration

Make target API level to 24 or higher and add the following attribute to your activity

android:resizeableActivity=["true" | "false"]

if this is set to true then only your app will support multi window. Also if you set this attribute true in root activity then all the activities will support multi window.
If your app target is API 24, and you didn’t specify this attribute then it is true by default.

Addition to Layout Attributes

android:minHeight="100dp"
android:minWidth="100dp"

These are the new addition which defines the minimum height and width which your activity can have while it is in multi-window.

For more details please refer to below link
Multi-Window

Thanks for reading 🙂

Happy developing.



Leave a comment