Private Sub SetWallpaper(bmp As B4XBitmap, LockScreen As Boolean, HomeScreen As Boolean)
Dim wallpaper As JavaObject
Dim context As JavaObject
context.InitializeContext
wallpaper = wallpaper.InitializeStatic("android.app.WallpaperManager").RunMethod("getInstance", Array(context))
Dim flags As Int = 0
If LockScreen Then flags = Bit.Or(flags, 2)
If HomeScreen Then flags = Bit.Or(flags, 1)
wallpaper.RunMethod("setBitmap", Array(bmp, Null, True, flags))
End Sub