Android Question Screenshot has transparent background (Solved)


Active Member
Licensed User
I am using this example found in the forum:

(Note: the code below has been fixed and now works)

Sub TakeScreenshot
    Log( "TakeScreenshot activated" )
    ' Take a screenshot.

    Dim Obj1, Obj2 As Reflector
    Dim bmp As Bitmap
    Dim c As Canvas
    Dim now As Long
    Dim dt As String
    DateTime.DateFormat = "dd-MMM-yyyy HH:mm:ss"
    now =
    dt = now )
    Activity.Color = Colors.Black ' added this line
    Obj1.Target = Obj1.GetActivityBA
    Obj1.Target = Obj1.GetField( "vg" )
    bmp.InitializeMutable( Activity.Width, Activity.Height )
    Dim args(1) As Object
    Dim types(1) As String
    Obj2.Target = c
    Obj2.Target = Obj2.GetField( "canvas" )
    args(0) = Obj2.Target
    types(0) = ""
    Obj1.RunMethod4( "draw", args, types )
    Dim Out As OutputStream
    ScreenShotFolder = Starter.DownloadPath ' replace with your path
    ScreenShotFile =  dt & ".png"
    Out = File.OpenOutput( ScreenShotFolder, ScreenShotFile, False )
    bmp.WriteToStream( Out, 100, "PNG" )
    ToastMessageShow( "Screenshot Captured", False )
End Sub
The activity background, labels background and spinners backgrounds are transparent. Even worse, the spinners have the default white font intended for a black background and are totally unreadable. The labels have grey text color and are readable, albeit not easily. The buttons and I have a picture that are also correctly represented.

What can I do to have a screenshot with the same background as the screen?


Last edited:


Active Member
Licensed User
Of course that did it :)
Thank you Erel.

PS: I edited the code block to include your suggestion.