Reflection Library / Screenshot

prokli

Active Member
Licensed User
Longtime User
Hello everybody!!

To make a screenshot, I am using the code as it has been provided by "agraham":

Sub ScreeShot(fName As String)As String

Dim Obj1, Obj2 As Reflector
Dim bmp As Bitmap
Dim c As Canvas
Dim Out As OutputStream
Dim c1 As Int
Dim ret As Int

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)
Out = File.OpenOutput(File.DirDefaultExternal & "/" & globv.cCHARTS, Name, False)
bmp.WriteToStream(Out, 100, "JPEG")
Out.Close

End Sub

This code worked perfectly for several month without any error output!
But actually, when program comes to the next code line, the android OS terminates the app without generating an error!!

Obj1.Target = Obj1.GetActivityBA

It seems that this part of code needs a quite long time to be executed and this might be the reason why OS stops the app.
But why does it happen now??

Please :sign0085:
 

prokli

Active Member
Licensed User
Longtime User
It's been solved :sign0060:

There exists a new reflection library for (Vers. 2.20) which has to be taken for the latest version of Basic4android (2.0 or later)
Great!

Please ignore this thread!
 
Upvote 0

prokli

Active Member
Licensed User
Longtime User
I just meant, that I don't need any further help!
Of course, this information might be important for other readers.
I suppose its German thoroughness discussing the meaning of sentences :sign0089:
 
Upvote 0

RiverRaid

Active Member
Licensed User
Longtime User
Hi!

Is there a way to get the screenshot only from a specific RECT on the screen of my app? (without Titlebar)

Thanks!
 
Upvote 0
Top