A Complete Guide to Android Foldable Devices: Unfolding the Future

Krunal Nayak
Simform Engineering
5 min readDec 22, 2023

Explore how to fold and unfold the device with the Android Jetpack component.

In recent years, the tech world has witnessed a revolutionary trend with the introduction of foldable devices. These devices offer an innovative blend of portability and functionality, giving users the ability to seamlessly transition between different form factors. In this blog, we’ll dive into the world of foldable devices in Android, exploring their unique features, design considerations, and how developers can create optimized apps for these devices.

The rise of foldable devices

Foldable phone shipments are expected to reach 21.4 million units in 2023, a 50% increase from 14.2 million in 2022. By 2027, the number will cross 48.1 million, with a compound annual growth rate of 27.6%. Despite the growth, foldable smartphones remain in premium price segments, with average selling prices dropping by 6.8% in 2023. Companies are investing in software and hardware enhancements to drive continued adoption.

Foldable devices represent a complete departure from traditional smartphones and tablets. They feature flexible screens that can be folded and unfolded, enabling a variety of usage scenarios. With the expansion of the Android ecosystem to support these devices, developers have been presented with exciting new challenges and opportunities.

Designing for foldable devices

Designing for foldable devices requires a reimagination of user interfaces. Apps need to adapt gracefully to different screen sizes and orientations as the device is folded and unfolded. To achieve this, developers must leverage Android’s built-in support for foldable and multi-window environments.

Key design considerations:

  1. Multi-Window Support: Android allows apps to run in multiple windows simultaneously. Developers must ensure that their apps can be used effectively in split-screen and freeform modes. You can check and follow the official guidelines to support this.

2. Adaptive Layouts: Adopting ConstraintLayout and other layout management tools can help create dynamic interfaces that adjust to various screen sizes and orientations. You can adjust the layout with these developer guidelines.

3. Flex Mode: Foldable devices often support a “flex mode,” where the screen is partially folded. Apps should be optimized for this mode, adapting their layout to the available screen real estate.

4. Continuity: Users should experience seamless continuity as they transition from one form factor to another. Data and states should be preserved during these transitions. To learn more about managing app state and continuity, see Save UI states.

Development strategies for foldable devices

Developers must understand the new features and APIs introduced for foldable devices to create apps that fully utilize their capabilities.

  1. Multi-Resume: Foldable devices allow multiple apps to be simultaneously active in split-screen mode. Developers should ensure their apps handle multi-resume scenarios correctly by following these guidelines.
  2. Window Management: Android provides APIs for managing multiple windows, including resizing, positioning, and focusing. Developers should familiarize themselves with these APIs for optimal app behavior.
  3. Display Cutouts and Notches: Foldable devices may have unique screen configurations. Developers should adapt their UI to accommodate display cutouts and notches.

Optimizing existing apps

Adapting existing apps for foldable devices involves a combination of design, layout, and coding adjustments. Prioritize core functionality and make strategic decisions about how to take advantage of foldable features best.

Embrace the future of mobility

As foldable devices become more prevalent, developers have an exciting opportunity to shape the future of mobile computing. By understanding the unique challenges and possibilities offered by these devices, developers can create apps that provide users with unparalleled flexibility and functionality.

Here is an example of how you could handle a foldable and unfoldable device within a single activity that contains the most commonly used list view and detail view screens:

The Jetpack WindowManager library helps application developers support new device form factors and provides a common API surface for various WindowManager features on both old and new platform versions.

Add this to your app/build.gradle. This setup enhances window management and lifecycle handling in the Android application.

You can observe WindowInfoTracker in lifecycleScope and update your UI accordingly.

Here, we are getting displayFeatures from WindowLayoutInfo and expanding collapse accordingly.

In this method, we enable a detailed screen layout with the help of folded points.

This method will set the initial layout back and set the UI for the list screen layout.

Output:

List screen when we have not added WindowInfoTracker and the device is unfolded:

Here’s the list screen when we have added WindowInfoTracker and the device is unfolded. It will have a detail screen along with it:

Conclusion

Android has improved support for foldable devices, focusing on responsive design. This allows apps to adapt to different display sizes, presenting both challenges and opportunities for developers. Android provides resources for creating responsive layouts.

For more updates on the latest tools and technologies, follow the Simform Engineering blog.

Follow Us: Twitter | LinkedIn

--

--