Android Question Captures the mobile screen

Blueforcer

Well-Known Member
Licensed User
Longtime User
 
Upvote 1

carlos7000

Well-Known Member
Licensed User
Longtime User
I already looked at the link, but it is for recording video. I suppose this information will be useful to me later. I am looking for something that takes a screenshot and saves it to a jpg file.

Even though I copied the library to the B4A library folder, I tried to compile the example without modifying anything, but it does not compile.

I checked the code, but I didn't find anything about how to take a screenshot. I must have overlooked it.
 
Last edited:
Upvote 1

edgar_ortiz

Active Member
Licensed User
Longtime User
You can try:

B4X:
Sub Tomar_ScreenShot
    Dim lcView As B4XView = Activity
    Dim lcScreenShot As Bitmap = lcView.Snapshot
    Dim Out As OutputStream
    Dim lcFileName As String = Starter.wceNombreEncuesta & ".png"
    Out = File.OpenOutput(File.DirDefaultExternal, lcFileName, False)
    lcScreenShot.WriteToStream(Out, 100, "PNG")
    Out.Close
End Sub
 
Upvote 0

carlos7000

Well-Known Member
Licensed User
Longtime User

I tried to test the code but b4a tells me that B4XView is an unknown member. Am I missing a library or something else?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…