Android Question Help please

roy89

Member
Hi, I'm new to this world. Can you help me with the code to create my first project? I just need to change my phone's wallpaper, but the codes I've found online give me errors. Thanks! I'm using B4A
 
Good morning, my friend Erel, thanks to your code, I was able to set the phone's wallpaper, but now how can I use it so that the background change is applied with a button? Because it is created so that when opening the application, it changes the background automatically. Could you help me? Here is the code provided by you:

Post the (relevant) code that you are running and the error message. Right click to copy the logs.
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
SetWallPaper(LoadBitmap(File.DirAssets, "p.jpg"))
End Sub

Sub Activity_Pause(UserClosed As Boolean)

End Sub
Sub Activity_Resume

End Sub
Sub SetWallPaper(Bmp As Bitmap)
Dim r As Reflector
r.Target = r.RunStaticMethod("android.app.WallpaperManager", "getInstance", _
Array As Object(r.GetContext), Array As String("android.content.Context"))
r.RunMethod4("setBitmap", Array As Object(Bmp), Array As String("android.graphics.Bitmap"))
End Sub

Private Sub Button1_Click

End Sub
 
Upvote 0
Thanks, I already solved the problem. You're very kind. The forum is full of information to learn from. I'm from Cuba. Honestly, your application will help me a lot because I have limited internet access.
 
Upvote 0
Back
Top