possiedo una app che esegue questo codice del modulo Main
B4X:
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Main")
Activity.LoadLayout("Main")
ImageView1.Bitmap=LoadBitmap(File.DirAssets,"logo.png")
timer1.Initialize("timer1",250)
timer1.Enabled = True
Label3.Text="▄"
#BridgeLogger: True
End Sub
accade però che quando avvio la app vedo una schermata tutta grigia senza nessun elemento, soltanto se tolgo il focus alla app poi la riapro vedo il layout grafico sul display dello smartphone
eseguo anche questo codice del modulo starter
B4X:
Sub Service_Start (StartingIntent As Intent)
'Notification1.SetInfo("Ricezione SMS", "in ascolto",Main)
'Service.StartForeground(1, Notification1)
If StartingIntent.Action = "android.provider.Telephony.SMS_RECEIVED" Then
Dim messages() As Message
messages = ParseSmsIntent(StartingIntent)
For i = 0 To messages.Length - 1
Log(messages(i))
Next
End If
Service.StopAutomaticForeground
End Sub
qualcuno a idea di quale possa essere il motivo per il quale non carica il layout al primo avvio della app?
Non sono sicuro che cambi qualcosa, ma prova a spostare il BridgeLogger in questo modo
B4X:
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
#BridgeLogger: True
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub
Prova, come test, a spostare il timer enable al click di un tasto (oppure ad aumentare il delay da 250 a 2000)
Temo che i 250ms non siano sufficienti a consentire il loadlayout compelto e il completamento dei campi imageview e label.