Displaying screen only once

walterf25

Expert
Licensed User
Longtime User
Hello everybody, i was wondering if anyone could help me out, i have my app almost finished but i wanted to display sort of a splashcreen but only once the first time the app is installed and opened for the first time, can anyone here help me with this, i'm pretty sure is something simple but my brain is fried right now.

Thank guys,

Walter
 

99toLife

Member
Licensed User
Longtime User
Put something like this in Activity_Create:

B4X:
Dim prefString As String
prefString = StateManager.GetSetting2("only_once", "0")
If (prefString <> "1") Then
     ' Insert code to do what you want here...
     ' ...

     StateManager.SetSetting("only_once", "1") ' Set this so code doesn't run again
     StateManager.SaveSettings
End If

You'll also need StateManager and enable the RandomAccessFile library.
 
Last edited:
Upvote 0

susu

Well-Known Member
Licensed User
Longtime User
I think this way is better:

B4X:
Sub Activity_Create(FirstTime As Boolean)
   If File.Exists(File.DirInternal,"check.1") = False Then
        File.WriteString(File.DirInternal,"check.1","blahblah")
        DoSomeThing   'Sub to do what you want when app runs first time
        End If
 
Upvote 0
Top