android icon indicating copy to clipboard operation
android copied to clipboard

Unsaved form data isn't persisted when app is paused

Open davirec opened this issue 2 years ago • 3 comments

When I perform these sequences of events, the text disappears:

  1. Go to the Main activity (Welcome to EteSync!)
  2. Tap in add (plus in the right bottom)
  3. Tap in Sign Up
  4. Write username, email, and password.
  5. A activity similar to this will appear:
  1. Force the pause from the activity and then return to the activity (double rotation). Note that the text disappears. Note: the pause from activity can be performed in several ways. We suggest using a double rotation (starts in portrait, goes to landscape, and back to portrait) with this function previously enabled in the smartphone.

The expected behavior is the return to the previous state with the text of the last image.

However, the text disappears.

Device:

  • Device: Moto G30 with OS: Android 11
  • Version: 2.2.4
  • Device language: English

davirec avatar Mar 06 '22 01:03 davirec

What do you mean by data loss? No actual data loss, just the active form data is wiped when you are still actively using it?

tasn avatar Mar 06 '22 10:03 tasn

A data loss problem occurs when data is accidentally deleted or state variables are accidentally assigned with default or initial values. This issue is related to the activity's lifecycle (1). When a screen rotation occurs, the activity is destroyed and resumed. Data loss will happen if the developer does not save the variables before the destruction and restore them after creation. It can be done through lifecycle callback implementation.

  1. https://developer.android.com/guide/components/activities/activity-lifecycle

davirec avatar Mar 09 '22 03:03 davirec

Yeah, I'm aware of the process you're describing. It's just not "data loss" which usually means persisted data was lost. This is a case of a minor (yet annoying!) UI inconvenience.

tasn avatar Mar 09 '22 09:03 tasn