Android Question reflector method affect other target

Discussion in 'Android Questions' started by le_toubib, Feb 25, 2015.

  1. le_toubib

    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?
    Code:
    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 / 1602) + Power(lv.Width / lv.Scale / 1602))
    End Sub
     
  2. Erel

    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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice