Screenshot??

tdocs2

Well-Known Member
Licensed User
Longtime User
Screen shots

If you are connected to the IDE, Just select tools/take screenshot. I hope I have not missed the question.

Hello, Margret.

Thank you for all of your postings and insights.

The screenshot feature does not work if the connection to the IDE is via the B4A bridge... It works only on a direct USB connection.

Best regards.

Sandy
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
Thanks Margret, but sorry not getting it. I thought the question was:
Would like to take a screenshot from the device (the phone) at runtime while
connected to the computer via USB. emulator wouldn't give you a realistic
picture of the app like when it runs on a physical device.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You can take a screenshot of the device running when connected via USB directly in the IDE. Beginner's Guide page 53.

You can also take a screenshot with following code in the application:
B4X:
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
Beginner's Guide chapter 17.15

Best regards.
 
Upvote 0

sagt3k

Member
Licensed User
Longtime User
Share the image captured

And if i wanted to start the gallery with the sharing ? Intent example pleaseeee ??
 
Last edited:
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
Upvote 0

gregwa

Member
Licensed User
Longtime User
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.
 
Upvote 0

yttrium

Active Member
Licensed User
Longtime User
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.

Note the date this thread was posted and how it was already answered.

Also, sometimes you want to initiate the screenshot via software so the user does't have to do anything.
 
Upvote 0
Top