visit
Google’s representative Dave Burke described the foldable experience as “Screen Continuity” where the application experience transfer between bigger and smaller screens seamlessly.
App continuity
Whenever you are folding or unfolding your device, it triggers configuration changes:So it becomes important for developers to store the previous state of the application. For this developers can use onSaveInstanceState() and ViewModel object.
Before the activity is destroyed, you can save its state using onSaveInstanceState() and restore it using onCreate() or onRestoreInstanceState().
Multi-window
As you all may know, there are two types of multi-window –Multi-resume
In the earlier versions of Android, multi-window support only one app active at a time. The other app will be paused when it not active.Android Pie offered the support of multi-resume functionality but it was up to the app developers and OEM’s (Original Equipment Manufacturer) whether to opt in or not.So we can expect Android Q will offer multi-resume as a mandatory behavior.To make you app multi-resume, you have to set the manifest flag so that it can keep the app in the resumed state.<application>
<meta-data
android:name=”android.allow_multiple_resumed_activities”
android:value=”true” />
<activity … />
</application>
Optimized layouts
As the app will be running on both the displays so it would be better to add a separate resource folder to show more rich content. Here is a link for better understanding –Testing your app in a foldable device
You can easily test your app in a foldable environment by running a foldable emulator provided by Samsung.$ adb install FoldableEmulator.apk
PC: ~$ adb shell
AVD: /$ pm grant com.samsung.android.foldable.emulator android.permission.WRITE_SECURE_SETTINGS
AVD: /$ pm grant com.samsung.android.foldable.emulator android.permission.SYSTEM_ALERT_WINDOW