Android Question change reflector to java object

ArminKH

Well-Known Member
hi can every body please convert this code to JavaObject?
B4X:
  Dim Bounds As Rect
      Bounds.Initialize(0,0,0,0)
  Dim r As Reflector
      r.Target=lbl
      r.Target = r.GetContext
      r.Target = r.RunMethod("getResources")
      r.Target = r.RunMethod("getDisplayMetrics")
      Return((Bounds.Right - Bounds.Left)* r.GetField("xdpi")/ 160)

i can't change this r.Target = r.GetContext to javaobject
THIS code not worked for me
B4X:
   Dim jo =LBL As JavaObject
       jo.RunMethod("getResources",Null)
       jo.RunMethod("getDisplayMetrics",Null)
       Return((Bounds.Right - Bounds.Left)* jo.GetField("xdpi")/ 160)

tnx
 
Last edited:
Top