Android Question Webview different resolutions

stevenindon

Active Member
Licensed User
Hello all,

I have been using webview for my application and all was running well. But recently i installed my app on another android phone but the resolution seems
to be very different from most of the phones that i have tested.

Please look at attached images.

p/s: Image Phone1.jpg is normal and Phone2.jpg (New phone) looks very low resolution and huge.

How can i programmatically fix this issue?

These are my init for my webview :


B4X:
'******************************************************
'INIT BROWSER
'******************************************************
Private Sub InitBrowser
    'INITIALIZING ALL WEVIEWCLIENT COMPONENTS
    WebChromeClient.Initialize("WebChromeClient")
    JavascriptInterface.Initialize
    'ADDING JAVASCRIPT SUPPORT
    MyWebViewExtras.Initialize(WebView1)
    MyWebViewExtras.SetWebChromeClient(WebChromeClient)
    MyWebViewExtras.AddJavascriptInterface(JavascriptInterface,"PBrowser")
    'CREATE WEBVIEW-CLIENT
    MyWebViewClient.Initialize("MyWebViewClient")
    MyWebViewExtras.SetWebViewClient(MyWebViewClient)
    'ADDING JAVASCRIPT ENABLE AND ZOOM FALSE
    MyWebViewExtras.JavaScriptEnabled=True
    MyWebViewExtras.ZoomEnabled=False
    setScrollBarEnabled(MyWebViewExtras,False,False)
    'SET BROWSER TO RESTORE STATE - FOR HISTORY
    If Bundle.IsInitialized Then
        Dim jo As JavaObject = MyWebViewExtras
        jo.RunMethod("restoreState", Array(Bundle))
    Else
        Comp_InitWeb_View("310","P")
    End If
End Sub



B4X:
'******************************************************
'WEBVIEW - INIT
'******************************************************
Sub Comp_InitWeb_View(strZoom As String,strOrientation As String)
    RefObj.Target = MyWebViewExtras
    RefObj.RunMethod2("setInitialScale", "" & strZoom & "", "java.lang.int")
    '*********************
    'SET NO SCROLL BOUNCE
    '*********************
    Dim jwv As JavaObject = WebView1
    Dim view As JavaObject
    view.InitializeStatic("android.view.View")
    jwv.RunMethod("setOverScrollMode", Array(view.GetField("OVER_SCROLL_NEVER")))
End Sub
 

Attachments

  • Phone1.jpg
    Phone1.jpg
    67.8 KB · Views: 138
  • Phone2.jpg
    Phone2.jpg
    177.5 KB · Views: 135
Top