Hello
I want to set wallpaper without zoom crop (i want the exact size of my image)
I do this to set a wallpaper :
r.RunMethod("suggestDesiredDimensions(360,640)") return an error :
LastException java.lang.NoSuchMethodException : suggestDesiredDimension(360,640)
I want to have this width and height
the java code sample is :
Thx for your help
I want to set wallpaper without zoom crop (i want the exact size of my image)
I do this to set a wallpaper :
B4X:
Sub SetWallPaper(myBmp 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(myBmp), Array As String("android.graphics.Bitmap"))
r.RunMethod("suggestDesiredDimensions(360,640)") ' HERE IS THE ERROR LINE
End Sub
Sub Button1_Click
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal, "myPicture.jpg", False)
bmp.WriteToStream(out,100,"JPEG")
out.Close
SetWallPaper(LoadBitmap(File.DirRootExternal, "myPicture.jpg"))
End Sub
r.RunMethod("suggestDesiredDimensions(360,640)") return an error :
LastException java.lang.NoSuchMethodException : suggestDesiredDimension(360,640)
I want to have this width and height
the java code sample is :
WallpaperManager wm = (WallpaperManager) getSystemService(WALLPAPER_SERVICE);
wm.setBitmap(bitmap);
wm.suggestDesiredDimensions(w, h);
and remember to add permissions:
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS"/>
<uses-permission android:name="android.permission.SET_WALLPAPER"/>
Thx for your help
Last edited: