'B4XMain_Page->B4XPage_Created
If UserIsLogged Then 'UserIsLogged could be a variable saved in KVS when the user logs in for first time
ShowDashboard
Else
Login
End If
Private Sub Login
Root.LoadLayout("Login") 'Login
B4XPages.SetTitle(Me, "Login")
End Sub
Public Sub ShowDashboard
Root.RemoveAllViews 'You can call ShowDashboard not only when you open the app starts and the user is logged, but the first time the user logs in, so you want to hide the Login layout
B4XPages.SetTitle(Me, "Dashboard")
Root.LoadLayout("Dashboard")
'... rest of your code
End Sub