Trying to display a welcome screen to the user

Inman

Well-Known Member
Licensed User
Longtime User
My app has some gestures that the user needs to be familiar with and so I thought I should show a welcome screen the first time the user runs the app.

In the first line of Main activity's Activity_Create function, I check if the welcome screen has been displayed before and if not, I start the Welcome activity. The problem is, in the Main activity there are lots of asynchronous processes (like downloads) running. I am not sure but probably because of that, when the Welcome activity loads, it closes automatically in 2 seconds and the focus is back in Main activity.

I tried using StartActivity and CallSubDelayed2 to start the Welcome activity. Even tried adding a DoEvents after the commands but the result is always the same. Ideally the Welcome activity should be displayed and once the user closes it, the app should continue with the Main activity.

Any way to do this?
 

Inman

Well-Known Member
Licensed User
Longtime User
Okay. I am using HttpUtils2 already. But here is what I don't understand. If I am using StartActivity in the very first line of Main activity's Activity_Create function, shouldn't all further execution below that line stop as the focus shifts to the new activity?
 
Upvote 0

Inman

Well-Known Member
Licensed User
Longtime User
Ah! So I think this new activity is opened only after going through Activity_Create and Activity_Resume of the Main activity.

Any way to pause the rest of the execution and start the welcome activity immediately?
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Ah! So I think this new activity is opened only after going through Activity_Create and Activity_Resume of the Main activity.

Any way to pause the rest of the execution and start the welcome activity immediately?

Why don't you use a panel above the main content of your activity? This panel hides what's behind and provides the background of your welcome screen.
 
Upvote 0

Inman

Well-Known Member
Licensed User
Longtime User
You cannot pause the execution. You can however move the rest of the code to a different sub and then run this sub when the second activity completes. You can use CallSubDelayed from the second activity to show the first one and start from this sub.

Cool. I will try that.

Why don't you use a panel above the main content of your activity? This panel hides what's behind and provides the background of your welcome screen.

Hmm. Never really thought of it. I will give it a try as well.
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
Just another note, you should probably use the FirstTime boolean in Activity_Create to display the Welcome screen, rather than a declared variable.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Just another note, you should probably use the FirstTime boolean in Activity_Create to display the Welcome screen, rather than a declared variable.

I don't think that FirstTime should be used for this because this boolean means that you launched the app and its data are not yet in memory. It doesn't mean: the user just opened the app. If you close the app then reopen it, FirstTime = false because the main activity is still in memory.
 
Upvote 0
Top