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

Discussion in 'Android Questions' started by Scotter, Apr 8, 2019.

  1. Scotter

    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: Apr 8, 2019
  2. Jeffrey Cameron

    Jeffrey Cameron Active Member Licensed User

    BillMeyer and Scotter like this.
  3. Erel

    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:
    Code:
    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
     
    Jeffrey Cameron likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice