I am a novice.
How can I set Activity.Background as the current wallpaper in B4A?
Activity.Background = ???
Thank you!
JAVA CODE
=======================
I have got it! Thank everyone!
How can I set Activity.Background as the current wallpaper in B4A?
Activity.Background = ???
Thank you!
JAVA CODE
B4X:
final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
Main.this.getWindow().setBackgroundDrawable(wallpaperDrawable);
=======================
I have got it! Thank everyone!
B4X:
Dim r As Reflector
Dim b As Bitmap
Dim d As BitmapDrawable
b.InitializeMutable(Activity.Width,Activity.Height)
d.Initialize(b)
r.Target = r.RunStaticMethod("android.app.WallpaperManager", "getInstance", Array As Object(r.GetContext), Array As String("android.content.Context"))
Activity.Background = r.RunMethod("getDrawable")
Last edited: