Hi everyone,
I have some questions and issues related to setting images as wallpapers :
Thank you!
I have some questions and issues related to setting images as wallpapers :
- How can I set an image specifically for the home screen, the lock screen, or both? I couldn’t find separate code examples for each of these.
- How can I detect if setting the wallpaper was successful? Something similar to the "Wait For" command. For example, I’d like to show a toast message upon success or failure.
- I used the following code shared by @Erel on the forum.
B4X:Dim wallpaper As JavaObject Dim context As JavaObject context.InitializeContext wallpaper = wallpaper.InitializeStatic("android.app.WallpaperManager").RunMethod("getInstance", Array(context)) wallpaper.RunMethod("setBitmap", Array(bim))
This code simultaneously sets the wallpaper for both the home screen and the lock screen. However, the problem is that when I use this code to set the wallpaper, it takes a few seconds, and then the activity (or the entire app) reloads or refreshes. (In my future projects, I plan to use B4XPages .) I'm not sure why this happens. Additionally,
I’m using RecyclerView and the SMM library for this task.
Thank you!