Android Question reflector method affect other target

le_toubib

Active Member
Licensed User
hello there
the following code works fine on the specified target however , it s affects other views as well ???? (labels appear half painted, half transparent) even though nothing is public here
what am i doing wrong?
B4X:
Sub showpreview
    pnl_preview.Visible=True
    WebView1.LoadHtml(report)
    WebView1.Visible=True
''''''''''''''''gets device size
   Dim s As String
   Dim f As Float
   Dim obj1 As Reflector

   obj1.Target = WebView1
   s = obj1.TypeName
   f = obj1.RunMethod("getScale")
   
    If GetDevicePhysicalSize > 6 Then    ' 7" or bigger tablet
       WebView1.Width=100%x
       obj1.RunMethod2("setInitialScale", "200", "java.lang.int")
    Else
       WebView1.Width=100%x
       obj1.RunMethod2("setInitialScale", "175", "java.lang.int")

   End If


End Sub


Sub GetDevicePhysicalSize As Float
    Dim lv As LayoutValues
    lv = GetDeviceLayoutValues
    Return Sqrt(Power(lv.Height / lv.Scale / 160, 2) + Power(lv.Width / lv.Scale / 160, 2))
End Sub
 

Erel

Administrator
Staff member
Licensed User
Note that you can use GetDeviceLayoutValues.ApproximateScreenSize instead of this sub.

I don't see how this code can affect other views unless you are referring to views inside the WebView.
 
Top