Android Question Black screen at the beginning

Pablo Torres

Active Member
Licensed User
Longtime User
Hi, in my android app there is a black screen at the beginning I cannot take away
It takes 8 seconds to go away
It is really annoying, I would like to show an image instead of that, I have no idea how to do it

Can anyone help me please?
 

Star-Dust

Expert
Licensed User
Longtime User
Hi, in my android app there is a black screen at the beginning I cannot take away
It takes 8 seconds to go away
It is really annoying, I would like to show an image instead of that, I have no idea how to do it

Can anyone help me please?
Have you completed in release mode?
Or did you send in debug mode and wait for a connection to the computer?
 
Upvote 0

Pablo Torres

Active Member
Licensed User
Longtime User
The main module has this code in Activity_Create

B4X:
ModoVideo=False
    ModoResume=3
    Activity.LoadLayout("Altius")
    Sleep(100)
    ProgressDialogShow("INICIANDO APLICACIÓN")
    If FirstTime Then
        ConexionGps.Initialize("ConexionGPS")
        auth.initialize("auth")
        player1.Initialize("player")
    End If
    If Mapa.IsGooglePlayServicesAvailable = False Then
        ToastMessageShow("Instale Google Play Services.", True)
    End If
    ListaPaginas.Initialize
    MyFont=Typeface.LoadFromAssets("AvenirNext-Medium.otf")
    userLocation.Initialize2(0,0)
    Seleccion=0
    intAlto=100%y
    intAncho=100%x
    intAncho2=intAncho*(.94)
    scvGaleria.Initialize(intAncho2,"scvGaleria")
    scvGaleria2.Initialize(intAncho2,"scvGaleria2")
    IdApartamentoActual=0
    IdProyectoActual=0
    lstProyectos.Initialize
    lstApartamentos.Initialize
    lstPromos.Initialize
    ListaNombreProyectos.initialize
    listaMensajes.Initialize
    listaNoticias.Initialize
    lstShowrooms.Initialize
    lstShowroomsBilu.Initialize
    lstShowroomsMore.Initialize
    lstShowroomsNostrum.Initialize
    ListaApartamentosFavoritos.Initialize
    ListaProyectosFavoritos.Initialize
    lstBarriosBuscador.Initialize
    lstDormitorios.Initialize
    lstEstados.Initialize
    lstPisos.Initialize
    lstDormitoriosProyecto.Initialize
    lstEstadosProyecto.Initialize
    lstPisosProyecto.Initialize
    CargarShowrooms
    ObtenerPromos
    AjustarControles
    MenuOpen=False
    pnlLateral.Visible=False
    CargarFondosFijos
    sepVideo.Player = player1
    ProgressDialogHide
    If File.Exists(File.DirDefaultExternal,"IdCliente_Altius.txt") Then
        IdCliente=File.ReadString(File.DirDefaultExternal,"IdCliente_Altius.txt")
        CallSubDelayed(FirebaseMessaging,"Service_Create")
        MostrarPanel(pnlSeleccion)
        CargarMensajes
        CargarFavoritos
        btnAbrirSesion.Visible=False
    Else
        lblOfrecer.Visible=False
        MostrarPanel(pnlInicial)
    End If

I also have a Starter module (I think this is the problem) with the following code:

B4X:
#Region  Service Attributes
    #StartAtBoot: False
    #ExcludeFromLibrary: true
#End Region

Sub Process_Globals
    Public auth As FirebaseAuth
    Public facebook As FacebookSdk
End Sub

Sub Service_Create
    Log("AUTH CREATE")
    auth.Initialize("auth")
    facebook.Initialize
End Sub

Sub Service_Start (StartingIntent As Intent)
    Log("AUTH START")
    Main.ModoResume=2
End Sub

'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Service_Destroy
End Sub

I dont know how to solve it, by watching the log I can see Starter module starts inmediately and it takes a lot of time before starting to load Altius.bal
How can I improve it?
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
i would make a time measurement class, a simple stop watch where you call start and at stop output the time in ms into Log(..)
so you can measure a sub from start to end or parts.
if you found the biggest delays you can change your app flow or logic.
 
Upvote 0

Pablo Torres

Active Member
Licensed User
Longtime User
I solved
I created another activity, loaded that activity (only an image) with a timer for 1 second and then loaded the other activity.
It still takes about 10 second to really start but, all that time remains showing the first activity image and a progressdialog that says "starting activity", so the user dont get the impression the app is freeze.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…