Screenshot with the Reflection library

Asmoro

Active Member
Licensed User
Longtime User
Hi agraham,

First of all, thanks for the example.

I have a question to your screenshot code:

Sub Btn1_Click
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)
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, "Test.png", False)
bmp.WriteToStream(out, 100, "PNG")
Out.Close
End Sub

It seems that a USB connection/USB driver/adb daemon is needed to actually
make a screenshot and save it on the phone.

Is there another way to do this?

Asmoro
 

Asmoro

Active Member
Licensed User
Longtime User
Hi Erel,

Yes, with USB debugging it worked just fine and this feature is in fact
one of the crucial handlings for my app.

I already using ddms for dev purposes.

Agraham made this possible to make a screenshot within an activity (canvas).
Exactly what I want.

I think I will wait for the Gingerbread 2.3.4 version included with a screen capture feature.
At least for the Sony Ericsson Xperia models (well most of them).

Asmoro
 
Upvote 0

hackhack

Active Member
Licensed User
Longtime User
You cannot take screenshots in Android. There is an exception to this rule which can only be used after a device connects with USB debugging enabled (and therefore is not really useful, you can use ddms to take a screenshot in that case).

The transformer has a build in screen grab function, but this would be something ASUS has added then?
 
Upvote 0

Asmoro

Active Member
Licensed User
Longtime User
Does anyone has an example or tut how to make an imagefile of a canvas.

Because this would be a nice alternative for a screen capture function.

Thanks for now.

Asmoro
 
Upvote 0
Top