Several welcome activity launched when rotating
Closed this issue · 2 comments
FredJul commented
When you rotate the screen during the welcome screens (i.e. before you press "Done") , you'll end up with several identical welcome activities started.
That basically means that when you finish the welcome steps, you'll see a new welcome guide until you remove all the stacked welcome activities.
stephentuso commented
This is what WelcomeHelper#onSaveInstanceState
is for. See Show the welcome screen and make sure your code matches that.
FredJul commented
I forgot to mention that I actually did call WelcomeHelper#onSaveInstanceState
class EnterPinActivity : AppCompatActivity() {
private val welcomeScreen by lazy { WelcomeHelper(this, TutorialActivity::class.java) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// savedInstanceState is non-null when there is fragment state
// saved from previous configurations of this activity
// (e.g. when rotating the screen from portrait to landscape).
// In this case, the fragment will automatically be re-added
// to its container so we don't need to manually add it.
// For more information, see the Fragments API guide at:
//
// http://developer.android.com/guide/components/fragments.html
//
if (savedInstanceState == null) {
// Create the detail fragment and add it to the activity using a fragment transaction.
supportFragmentManager.beginTransaction()
.replace(android.R.id.content, EnterPinFragment())
.commit()
}
welcomeScreen.show(savedInstanceState)
}
override fun onSaveInstanceState(outState: Bundle?, outPersistentState: PersistableBundle?) {
super.onSaveInstanceState(outState, outPersistentState)
welcomeScreen.onSaveInstanceState(outState)
}
}
Maybe it's due to the use of Kotlin/lazy variable but I honestly don't see why it would cause any issue