beeware / briefcase-android-gradle-template

A template for generating Android Gradle projects with Briefcase
MIT License
21 stars 22 forks source link

Save and restore UI state #39

Closed t-arn closed 2 years ago

t-arn commented 2 years ago

When the orientation of an Android device is changed from portrait to landscape or vice versa, Android restarts the app and the data previously displayed in the UI is lost. To prevent this, Android has 2 callback methods: onSaveInstanceState() and onRestoreInstanceState().

This PR allows the programmer to add these two callback methods in his toga.App code. In onSaveInstanceState(), the programmer can then save the widget data and in onRestoreInstanceState(), he can restore the data after the app has restarted and the UI has been rebuilt.

This PR needs the PR https://github.com/beeware/toga/pull/1386

PR Checklist:

t-arn commented 2 years ago

@freakboy3742 Please review this PR

freakboy3742 commented 2 years ago

Closing on the basis that the ticket associated with this work has been closed.