I\'m trying to save and restore the state of an Activity
using the methods onSaveInstanceState()
and onRestoreInstanceState()
.
From the documentation Restore activity UI state using saved instance state it is stated as:
Instead of restoring the state during onCreate() you may choose to implement onRestoreInstanceState(), which the system calls after the onStart() method. The system calls onRestoreInstanceState() only if there is a saved state to restore, so you do not need to check whether the Bundle is null:
IMO, this is more clear way than checking this at onCreate, and better fits with single responsiblity principle.