Dim Paint As JavaObject
Dim Bounds As Rect
Bounds.Initialize(0,0,0,0)
Paint.InitializeNewInstance("android.graphics.Paint",Null)
Paint.RunMethod("setTextSize",Array(Label1.TextSize))
Paint.RunMethod("setTypeface",Array(Label1.Typeface))
Paint.RunMethod("getTextBounds",Array(Label1.Text,0,Label1.Text.Length,Bounds))
Dim r As Reflector
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
r.Target = r.RunMethod("getDisplayMetrics")
Log(r.GetField("xdpi"))
Log(r.GetField("ydpi"))
Log(Bounds.Left)
Log((Bounds.Right - Bounds.Left)* (r.GetField("xdpi")/ 160))
Dim PFM As JavaObject = Paint.RunMethod("getFontMetrics",Null)
Log(PFM.GetField("leading"))