Shows the same WelcomeScreen in two different sittuations
FelipePedrotiRaymundo opened this issue · 3 comments
It's more a question than an issue.
I have this case: I created a welcome screen for my app, it's like my app's overview. But I can show this screen again from a menu. Reading another issue listed, I can start the activity from my SplashScreen, and start my home screen when done.
But, when I forced show the WelcomeScreen, there is no way to know if it's forced show or not, and the activity was started again.
I achieved a way to do this, creating a shared preference and ignore the startActivity if it has the key, but I would like to know if is it possible to have a key or a property that flags the activity was forced shown or not.
The code from my done button (get the reference from yours button using butterknife)
@OnClick(com.stephentuso.welcome.R.id.wel_button_done)
public void mButtonDoneOnClickListener() {
completeWelcomeScreen();
if(!PreferenceManager.getDefaultSharedPreferences(MyWelcomeActivity.this).contains("intro"))
startActivity(new Intent(MyWelcomeActivity.this, MainActivity.class));
}
I'm not sure that I totally understand your question. When you force show it, it will always appear. If you only want to show it once you should just use show
. It might also be helpful to read Results in the readme.
If you want to start it from your splash screen rather than the home screen, you can:
- Start it normally as shown here
- If
.show
returns false, go ahead and show yourMainActivity
- Listen to the result of the welcome screen as linked in the above comment, on
RESULT_OK
showMainActivity
, onRESULT_CANCELED
exit the app
Closing due to inactivity