Android Question Best way to show user a quick message on top layer?

Scotter

Active Member
Licensed User
What are my options for displaying a quickie little messagebox telling a user something like, "Tap here" and then it disappears in like 2 seconds? As opposed to the one that has an OK button they have to press to get rid of?

This would be a lot easier than adding an image to the screen, telling it to appear, running a timer, and then telling the box to hide.

Thanks!
 
Last edited:

Erel

Administrator
Staff member
Licensed User
Option 1: https://www.b4x.com/android/forum/threads/msgbox2async-hide.104475/#post-654733

Option 2: Use B4XDialog with B4XTimedTemplate:
B4X:
Sub Globals
   Private Dialog As B4XDialog
   Private TimedTemplate As B4XTimedTemplate
   Private TextTemplate As B4XLongTextTemplate
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Dialog.Initialize(Activity)
   Dialog.Title = "Example"
   TextTemplate.Initialize
   TimedTemplate.Initialize(TextTemplate)
   TimedTemplate.TimeoutMilliseconds = 2000
End Sub

Sub Activity_Click
   TextTemplate.Text = $"

Click here!"$
   Dialog.ShowTemplate(TimedTemplate, "Ok", "", "")
End Sub
 
Top