Android Question Wallpaper slow start

carlos7000

Well-Known Member
Licensed User
Longtime User
Hi

I am writing a program that changes the background image.

When you run the program, the background appears blank for a few seconds. After the first image appears, when an application is finished or come back to the main screen, the background is white again and it takes again a few seconds for the first image to appear.

I understand that the Wllapaper waits for the appointed time to show each image.

How can I do to show the first image immediately?

Finally the images seem to change with random times, sometimes faster, sometimes slower. and with less time than indicated.

The service code is

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

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
 
    Dim lwm As LWManager
    Dim image As Bitmap 
 
    Dim i As Double
End Sub
Sub Service_Create
    lwm.Initialize("lwm", True)   
    lwm.StartTicking(7000) 
    i = 1 
End Sub

Sub Service_Start (StartingIntent As Intent)

End Sub

Sub Service_Destroy

End Sub

Sub lwm_SizeChanged (Engine As LWEngine)
    DrawBackground (Engine)
End Sub

Sub DrawBackground (Engine As LWEngine)
    Engine.Canvas.DrawColor(Colors.White)
    Engine.RefreshAll
End Sub

Sub lwm_VisibilityChanged (Engine As LWEngine, Visible As Boolean)
    If Visible Then
        DrawBackground (Engine)
    End If
End Sub

Sub lwm_Tick (Engine As LWEngine)
    Engine.Rect.Initialize(0dip, 0dip, Engine.ScreenWidth, Engine.ScreenHeight)
     
    If i>5 Then
        i=1
    End If
 
    Engine.Canvas.DrawColor(Colors.White)
    image.Initialize(File.DirAssets, "temp"&i&".jpg")
    Engine.Canvas.DrawBitmap(image, Null, Engine.Rect)
    i=i+1
 
    Engine.RefreshAll
End Sub


note: I tried to upload the project file but it didn't leave me. What is the maximum file size that can be uploaded?
 
Last edited:
Top