Android Question Taking a screenshot of whole (scrollable) panel.

Kapelis

Member
Licensed User
Longtime User
Hi, I'm trying to make a screenshot of my app, I have followed the example in the beginners guide and it all works well. I modified the code to get a screenshot of the whole panel but the photo is "cropped" at some point and the rest (bottom) of the picture is black. Can anyone help? thank you very much.
B4X:
Sub btnShare_Click
' Take a screenshot.
  Dim Obj1, Obj2 As Reflector
  Dim bmp As Bitmap
  Dim C As Canvas
  Obj1.Target = Obj1.GetActivityBA
  Obj1.Target = Obj1.GetField("vg")
  'bmp.InitializeMutable(Activity.Width, Activity.Height)
  bmp.InitializeMutable(Panel1.Width, Panel1.Height)
  C.Initialize2(bmp)
  Dim args(1) As Object
  Dim types(1) As String
  Obj2.Target = C
  Obj2.Target = Obj2.GetField("canvas")
  args(0) = Obj2.Target
  types(0) = "android.graphics.Canvas"
  Obj1.RunMethod4("draw", args, types)
  Dim Out As OutputStream
  Out = File.OpenOutput(File.DirRootExternal, "Aldrete score" & ".png", False)
  bmp.WriteToStream(Out, 100, "PNG")
  Out.Close
 
End Sub
 
Top