Android Question Best way to do a splash screen at app startup

Discussion in 'Android Questions' started by Kevin Hartin, May 11, 2019.

  1. Kevin Hartin

    Kevin Hartin Member Licensed User

    What is the best way to do a splash screen?
    1. Use a panel in main that goes invisible after a while or on click
    2. Create an activity that is called from main at end of Activity_Create
    3. Some other way
    My app is a OSMDroid tour app that the main layout is all built in Activity_Create rather than the designer. If this makes a difference...

    Thanks,
    Kev
     
  2. Scantech

    Scantech Well-Known Member Licensed User

    This is the way i do it. You can use a Timer to set the Image to false after certain amount of time.
    I use 3 doevents.. cause some device will not display the image with less then 3.
    Also, might want to use BringtoFront in case you load other layouts.
    Code:
    Sub Activity_Create(FirstTime As Boolean)
            LoadSplashVersion
            
    DoEventsDoEventsDoEvents              
    end sub
    Code:
    Sub LoadSplashVersion

        imvSplash.Initialize(
    "")
        
    Activity.AddView(imvSplash, 00250dip50dip)        'originally at 250dip, 50dip
      
        imvSplash.Left             = (
    Activity.Width - imvSplash.Width)   /2
        imvSplash.Top              = (
    Activity.Height - imvSplash.Height) /2
      
        imvSplash.Gravity         = 
    Gravity.FILL

      
        imvSplash.Bitmap         = 
    LoadBitmap(File.DirAssets, "CarGaugeSplash2.png")
        imvSplash.Visible         = 
    True
      

    End Sub
     
    Kevin Hartin likes this.
  3. Kevin Hartin

    Kevin Hartin Member Licensed User

    Thanks Scantech, I will give it a try.

    What are the 3 DoEvents :
     
  4. Scantech

    Scantech Well-Known Member Licensed User

    Last edited: May 12, 2019
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