Sub SetWallPaper(Bmp As Bitmap)
Dim r As Reflector
Dim intHeight As Int
Dim intWidth As Int
Dim intOffset As Double
Dim pScale As Double
Dim aLayOut As LayoutValues
aLayOut = GetDeviceLayoutValues
pScale = GetDeviceLayoutValues.Scale
' calculate the height of the device in relation to the bitmap
intOffset = (aLayOut.Height / Bmp.Height) * 0.8
' calculate the new height for the bitmap
intHeight = Bmp.Height * intOffset * pScale
' calculate the new width for the bitmap
intWidth = Bmp.Width * intOffset * pScale
Bmp = f.CreateScaledBitmap(Bmp, intWidth, intHeight, True)
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"))
Vibrate.Vibrate (50) ' Vibrate phone for 50 ms
ToastMessageShow(wpWallpaperSet, False)
End Sub