Android Question Screen capture box

Shivito1

Active Member
Licensed User
I want to use semitransparent object to select a portion of the screen and make a screen shot of it. however I cannot even find a way to get a screenshot.
 
Last edited:

Shivito1

Active Member
Licensed User
Okay, slow learner here. I think I figured it out.
If i edit this line (-- bmp.InitializeMutable(Activity.Width, Activity.Height) --) I think I can achieve my goal
B4X:
Sub MakeScreenshot As String
    Log("MakeScreenshot in Main aufgerufen")
    ' Take a screenshot.
    Private Obj1, Obj2 As Reflector
    Private bmp As Bitmap
    Private c As Canvas
    Private now, i As Long
    Private 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)
    Private args(1) As Object
    Private 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)
    Private Out As OutputStream
    Out = File.OpenOutput(File.DirRootExternal, dt & ".png", False)
    bmp.WriteToStream(Out, 100, "PNG")
    Out.Close
    Return File.Combine(File.DirRootExternal,dt&".png")
End Sub
 
Upvote 0

Shivito1

Active Member
Licensed User
My goodness how many road blocks can i hit in one day.
Exoplayer can not be captured using the above method.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…