How do we capture screenshot of the app while it is running?
If you are connected to the IDE, Just select tools/take screenshot. I hope I have not missed the question.
Sub btnScrShot_LongClick
' Take a screenshot.
Dim Obj1, Obj2 As Reflector
Dim bmp As Bitmap
Dim c As Canvas
Dim now, i As Long
Dim dt As String
DateTime.DateFormat = "yyMMddHHmmss"
now = DateTime.now
dt = DateTime.Date(now) ' e.g.: "110812150355" is Aug.12, 2011, 3:03:55 p.m.
Obj1.Target = Obj1.GetActivityBA
Obj1.Target = Obj1.GetField("vg")
bmp.InitializeMutable(Activity.Width, Activity.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, dt & ".png", False)
bmp.WriteToStream(Out, 100, "PNG")
Out.Close
End Sub
And if i wanted to start the gallery with the sharing ? Any tips or sample code?
Thanks
File.DirRootExternal, dt & ".png"
If you just want to manually take a screenshot and you are running android 4.0 you should be able to use the built in screenshot by pressing the power button and the volume down button at the same time.