Early snapshot

boten

Active Member
Licensed User
Longtime User
I know it is posibble to take a snap shot of the app's screen using reflection lib.

Is it possible to take a snapshot of the screen shown BEFORE the app us started, snapshot of the device's screen from where the app was started.?
 

boten

Active Member
Licensed User
Longtime User
B4X:
Activity.Color=Colors.Transparent
Doesn't do it. Still getting a black bg.

Also, taking a snapshot in a service pose a problem, as one line in the code of screen-capture is:
B4X:
 Obj1.Target = Obj1.GetActivityBA
and can't be done in a srevice.

Any other ideas?
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
Thx JonPM, I got a transparent activity. Alas - taking a picture using the reflection library produced a picture with black bg (plus any button or text i have on the activity) but not the home screen from which the app was launched.

I wonder how this should be done, as I can take picture of a home screen from outside an app, and I can take picture of a transparent activity, but NOT in combination of both.
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
How do you manage to do this?
I meant the volume up/down+power or in my ASUS JB long pressing the recent apps button.

No rooted device. I would just like my app to able to capture the home screen from which it was started and "work" on this picture withing the app as a bitmap.
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
Well, I was hoping to use something like the screen capture technique:
B4X:
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
but obviously it refers to the activity itself (as in GetActivityBA). I don't know enough about the internals to get the equivalent of this but from the home screen (??? GetOSBA ???).
You say it is only possible on a rooted device & from the framebuffer, so until someone will come up with a "simple" B4A solution, I might as well delve into other B4A projects.
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
yes, this gives a transparent activity, but still can't take picture of the home screen.
 
Upvote 0
Top