Android Question Reflector vs JavaObject


I am learning B4A and I would like to understand more about Reflector and JavaObject.
As far as I understand so far, the following code using Reflector:
Sub VideoFrameAtR(dir As String, f As String, ms As Long) As Bitmap   
    Dim r As Reflector
    Dim obj As Object
    Dim bmp As Bitmap    
    obj = r.CreateObject("")
    r.Target = obj
    r.RunMethod2("setDataSource", File.Combine(dir, f), "java.lang.String")
    bmp = r.RunMethod3("getFrameAtTime", ms*1000, "java.lang.long", 3, "")    ' 3=OPTION_CLOSEST
    Return bmp
End Sub
should be the same of the following that uses JavaObject (that I find more easy):
Sub VideoFrameAt(dir As String, f As String, ms As Long) As Bitmap   
    Dim job As JavaObject
    Dim bmp As Bitmap
    job.RunMethod("setDataSource", Array(File.Combine(dir, f)))   
    bmp = job.RunMethod("getFrameAtTime", Array(ms*1000, 3))
    Return bmp
End Sub

Then what is the difference between Reflector and JavaObject, if any ?
What code runs faster ?


Licensed User
Longtime User
No difference.
Was I then under the false understanding that the Reflector class allowed access to private methods/objects/data whereas JavaObject class only allowed access to public information?
Upvote 0