What We Want… and What We Do Not Want

We want to present a user interface that fits well with the current configuration. For example, we want to take advantage of the screen space that is given to us.

Conversely, we do not want to have a UI that fits poorly in the given space. For example, in landscape mode, our layout might be too tall. Even if we use a ScrollView to make it vertically scrollable, so the user can take steps to see the entire layout, that may not be very user-friendly.

However, despite the UI change, we want the user to think that nothing much unusual happened when the user triggered the configuration.

We do not want the user to regret that configuration change, such as by losing the data that we were showing (or, worse, that the user had entered or changed).

Over the years, we have spent a fair amount of time dealing with this challenge. There is a two-tier solution that seems to work best. In this chapter, we will focus on one of those tiers: retaining data using ViewModel.


Prev Table of Contents Next

This book is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license.