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:
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: