B4A Library WebViewExtras

Discussion in 'Additional libraries, classes and official updates' started by warwound, Nov 7, 2011.

  1. kkkpe

    kkkpe Member Licensed User

    HELP!! Open camera for input type file in Webview not opening
  2. warwound

    warwound Expert Licensed User

    WebViewExtras really needs an update to handle all the changes made in the WebView since KitKat and later.
    As well as 'camera input', the 'file upload' feature needs updating.

    Unfortunately i don't have the time to make such an update.
    I can make the source code available if anyone else wants to attempt an update...
    hibrid0 likes this.
  3. kkkpe

    kkkpe Member Licensed User

    you can do it with a donation?
  4. MetalOS

    MetalOS Member Licensed User


    I started on Basic4Android and I would load in a WebView a geolocated map Leaflet project. Only when using your library WebViewExtras 1.42, the WebView stays white and nothing is displayed. I do my testing on a Samsung Galaxy S4 on CyanogenMod 13 (Android 6.0.1). Thank you for your help.

    I joined you an example code that I use for testing:

    Attached Files:

  5. MarcoRome

    MarcoRome Expert Licensed User

    Hi All. I have this page in website:


    Now with this code, i can username and password and enter in the site.

    Sub WebView1_PageFinished (Url As String)
    If(CookieManager1.HasCookies) Then
    Log("Cookies: "&CookieManager1.GetCookie(Url))
    Log("No cookies found")
    End If

    If Url=LogonUrl Then
    Dim Javascript As StringBuilder
    "var form=document.forms[0];")   '   this assumes your form is the first form on the page
    "form.log.value='"& Starter.user &"';")
    "form.pwd.value='"& Starter.password &"';")
    Log("Executing javascript: "&Javascript.ToString)
    '    uncomment next line to auto submit the logon form
            '    be careful - if logon fails then the webpage will be reloaded
            '    and an infinite loop of failed logons is likely
            '    Javascript.Append("document.forms.fSSUser_Logon.submit();")
    Log("Form updated")
    End If
    End Sub
    Now the question is, can i in my code write as if user click about link "Registrati Ora" ( as in picture ) ??

    is source page i have this:
    Thank you all
  6. An Schi

    An Schi Well-Known Member Licensed User

    Is webviewextras2 compatible with all versions of android?

    It is running fine on my S4 with 5.0.1
    In Genymotion it is running fine on a 4.1
    But running it in Genymotion with 2.3.7 it crashes and in the logs are some strange things.

    In the manifest i have minsdk = 9 and targetsdk = 21.

    Right now i don't have time to look more at the logs or do more testing, so my question is:
    Is this library supposed to work with all android versions?
    Last edited: Jun 30, 2016
  7. Erel

    Erel Administrator Staff Member Licensed User

  8. An Schi

    An Schi Well-Known Member Licensed User

    I'll do in the evening when i am back at home.
    From memory it was something like "cannot find ressource martinpearman (blabla) webkit (blabla)" several times with different endings (if that helps...).

    Maybe it is irrelevant. I'd like to know if the library, and therefore my app, works on that anyway. Especially i would like to know what the minsdk is when i use this library.

    This was just a writing error. In my manifest i use targetsdk = 21 of course. (I've corrected the original post)
  9. An Schi

    An Schi Well-Known Member Licensed User

    Below is the full unfiltered log.
    Please don't forget that this is running a Samsung Galaxy S2, Android 2.3.7 with Genymotion.

    >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
    is OFF
    Calling main entry com.android.commands.pm.Pm
    Start proc com.android.defcontainer 
    for service com.android.defcontainer/.DefaultContainerService: pid=507 uid=10018 gids={10152001}
    GC_EXPLICIT freed 281K, 51% free 2684K/5447K, external 1625K/2137K, paused 24ms
    No content provider found for:
    No content provider found for:
    Scanning package: /data/app/vmdl1332398406.tmp
    Scanning package anschi.byhtest
    Unpacking native libraries for /data/app/anschi.byhtest-1.apk
    DexInv: --- BEGIN '/data/app/anschi.byhtest-1.apk' ---
    DexOpt: load 20ms, verify+opt 204ms
    DexInv: --- END '/data/app/anschi.byhtest-1.apk' (success) ---
      Services: anywheresoftware.b4a.samples.httputils2.httputils2service
      Receivers: anywheresoftware.b4a.samples.httputils2.httputils2service$httputils2service_BR
      Activities: anschi.byhtest.main
    Force stopping package anschi.byhtest uid=10027
    move /data/dalvik-cache/data@app@anschi.byhtest-1.apk@classes.dex -> /data/dalvik-cache/data@app@anschi.byhtest-1.apk@classes.dex
    New package installed in /data/app/anschi.byhtest-1.apk
    Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=516 uid=10006 gids={}
    no available voice recognition services found
    GC_EXPLICIT freed 1030K, 47% free 4136K/7687K, external 4378K/7378K, paused 42msShutting down VM
    GC_CONCURRENT freed 98K, 72% free 290K/1024K, external 0K/0K, paused 0ms+0ms
    adbd disconnected
    Pub com.svox.pico.providers.SettingsProvider: com.svox.pico.providers.SettingsProvider
    Start proc com.android.quicksearchbox for broadcast com.android.quicksearchbox/.CorporaUpdateReceiver: pid=525 uid=10003 gids={3003}
    Pub com.android.quicksearchbox.google: com.android.quicksearchbox.google.GoogleSuggestionProvider
    Pub com.android.quicksearchbox.shortcuts: com.android.quicksearchbox.ShortcutsProvider
    >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
    CheckJNI is OFF
    Calling main entry com.android.commands.am.Am
    Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=anschi.byhtest/.main } from pid 535
    Start proc anschi.byhtest for activity anschi.byhtest/.main: pid=542 uid=10027 gids={3003}
    HostConnection::get() New Host Connection established 0x96f0360, tid 212
    Shutting down VM
    GC_CONCURRENT freed 99K, 70% free 314K/1024K, external 0K/0K, paused 1ms+0ms
    adbd disconnected
    Could not find method android.view.ViewGroup.addChildrenForAccessibility, referenced from method anywheresoftware.b4a.BALayout.addChildrenForAccessibility
    VFY: unable to resolve virtual method 316: Landroid/view/ViewGroup;.addChildrenForAccessibility (Ljava/util/ArrayList;)V
    VFY: replacing opcode 0x6f at 0x0005
    VFY: dead code 0x0008-0008 in Lanywheresoftware/b4a/BALayout;.addChildrenForAccessibility (Ljava/util/ArrayList;)V
    Could not find method android.view.View.setPivotX, referenced from method anywheresoftware.b4a.objects.ViewWrapper.AnimateFrom
    VFY: unable to resolve virtual method 310: Landroid/view/View;.setPivotX (F)V
    VFY: replacing opcode 0x6e at 0x0013
    VFY: dead code 0x0016-00bf in Lanywheresoftware/b4a/objects/ViewWrapper;.AnimateFrom (Landroid/view/View;IIIII)V
    VFY: dead code 0x00c1-00c3 in Lanywheresoftware/b4a/objects/ViewWrapper;.AnimateFrom (Landroid/view/View;IIIII)V
    Could not find method android.animation.ValueAnimator.ofFloat, referenced from method anywheresoftware.b4a.objects.ViewWrapper.SetColorAnimated
    VFY: unable to resolve static method 12: Landroid/animation/ValueAnimator;.ofFloat ([F)Landroid/animation/ValueAnimator;
    VFY: replacing opcode 0x71 at 0x0033
    VFY: dead code 0x0036-0050 in Lanywheresoftware/b4a/objects/ViewWrapper;.SetColorAnimated (III)V
    Could not find method android.animation.ObjectAnimator.ofFloat, referenced from method anywheresoftware.b4a.objects.ViewWrapper.SetVisibleAnimated
    VFY: unable to resolve static method 7: Landroid/animation/ObjectAnimator;.ofFloat (Ljava/lang/Object;Ljava/lang/String;[F)Landroid/animation/ObjectAnimator;
    VFY: replacing opcode 0x71 at 0x001f
    Could not find method android.animation.ObjectAnimator.ofFloat, referenced from method anywheresoftware.b4a.objects.ViewWrapper.SetVisibleAnimated
    VFY: unable to resolve static method 7: Landroid/animation/ObjectAnimator;.ofFloat (Ljava/lang/Object;Ljava/lang/String;[F)Landroid/animation/ObjectAnimator;
    VFY: replacing opcode 0x71 at 0x0041
    VFY: dead code 0x0022-0039 in Lanywheresoftware/b4a/objects/ViewWrapper;.SetVisibleAnimated (IZ)V
    VFY: dead code 0x0044-0045 in Lanywheresoftware/b4a/objects/ViewWrapper;.SetVisibleAnimated (IZ)V
    Could not find method android.animation.ObjectAnimator.ofFloat, referenced from method anywheresoftware.b4a.objects.PanelWrapper.SetElevationAnimated
    VFY: unable to resolve static method 7: Landroid/animation/ObjectAnimator;.ofFloat (Ljava/lang/Object;Ljava/lang/String;[F)Landroid/animation/ObjectAnimator;
    VFY: replacing opcode 0x71 at 0x001f
    VFY: dead code 0x0022-002a in Lanywheresoftware/b4a/objects/PanelWrapper;.SetElevationAnimated (IF)V
    Could not find method android.animation.ValueAnimator.ofFloat, referenced from method anywheresoftware.b4a.objects.TextViewWrapper.SetTextColorAnimated
    VFY: unable to resolve static method 12: Landroid/animation/ValueAnimator;.ofFloat ([F)Landroid/animation/ValueAnimator;
    VFY: replacing opcode 0x71 at 0x0023
    VFY: dead code 0x0026-0040 in Lanywheresoftware/b4a/objects/TextViewWrapper;.SetTextColorAnimated (II)V
    Could not find method android.animation.ObjectAnimator.ofFloat, referenced from method anywheresoftware.b4a.objects.TextViewWrapper.SetTextSizeAnimated
    VFY: unable to resolve static method 7: Landroid/animation/ObjectAnimator;.ofFloat (Ljava/lang/Object;Ljava/lang/String;[F)Landroid/animation/ObjectAnimator;
    VFY: replacing opcode 0x71 at 0x001d
    VFY: dead code 0x0020-0028 in Lanywheresoftware/b4a/objects/TextViewWrapper;.SetTextSizeAnimated (IF)V
    Could not find method android.webkit.WebView.canZoomIn, referenced from method uk.co.martinpearman.b4a.webkit.WebViewExtras.CanZoomIn
    VFY: unable to resolve virtual method 464: Landroid/webkit/WebView;.canZoomIn ()Z
    VFY: replacing opcode 0x6e at 0x0006
    VFY: dead code 0x0009-000a in Luk/co/martinpearman/b4a/webkit/WebViewExtras;.CanZoomIn ()Z
    Could not find method android.webkit.WebView.canZoomOut, referenced from method uk.co.martinpearman.b4a.webkit.WebViewExtras.CanZoomOut
    VFY: unable to resolve virtual method 465: Landroid/webkit/WebView;.canZoomOut ()Z
    VFY: replacing opcode 0x6e at 0x0006
    VFY: dead code 0x0009-000a in Luk/co/martinpearman/b4a/webkit/WebViewExtras;.CanZoomOut ()Z
    Could not find method android.webkit.WebView.evaluateJavascript, referenced from method uk.co.martinpearman.b4a.webkit.WebViewExtras.ExecuteJavascript
    VFY: unable to resolve virtual method 472: Landroid/webkit/WebView;.evaluateJavascript (Ljava/lang/String;Landroid/webkit/ValueCallback;)V
    VFY: replacing opcode 0x6e at 0x000d
    Could not find method android.webkit.WebView.findAllAsync, referenced from method uk.co.martinpearman.b4a.webkit.WebViewExtras.FindAllAsynch
    VFY: unable to resolve virtual method 474: Landroid/webkit/WebView;.findAllAsync (Ljava/lang/String;)V
    VFY: replacing opcode 0x6e at 0x0006
    VFY: dead code 0x0009-0009 in Luk/co/martinpearman/b4a/webkit/WebViewExtras;.FindAllAsynch (Ljava/lang/String;)V
    Could not find method android.webkit.WebView.isPrivateBrowsingEnabled, referenced from method uk.co.martinpearman.b4a.webkit.WebViewExtras.IsPrivateBrowsingEnabled
    VFY: unable to resolve virtual method 491: Landroid/webkit/WebView;.isPrivateBrowsingEnabled ()Z
    VFY: replacing opcode 0x6e at 0x0006
    VFY: dead code 0x0009-000a in Luk/co/martinpearman/b4a/webkit/WebViewExtras;.IsPrivateBrowsingEnabled ()Z
    Could not find method android.webkit.WebView.removeJavascriptInterface, referenced from method uk.co.martinpearman.b4a.webkit.WebViewExtras.RemoveJavascriptInterface
    VFY: unable to resolve virtual method 502: Landroid/webkit/WebView;.removeJavascriptInterface (Ljava/lang/String;)V
    VFY: replacing opcode 0x6e at 0x0006
    VFY: dead code 0x0009-0009 in Luk/co/martinpearman/b4a/webkit/WebViewExtras;.RemoveJavascriptInterface (Ljava/lang/String;)V
    Could not find method android.webkit.WebView.saveWebArchive, referenced from method uk.co.martinpearman.b4a.webkit.WebViewExtras.SaveWebArchive
    VFY: unable to resolve virtual method 505: Landroid/webkit/WebView;.saveWebArchive (Ljava/lang/String;)V
    VFY: replacing opcode 0x6e at 0x0006
    VFY: dead code 0x0009-0009 in Luk/co/martinpearman/b4a/webkit/WebViewExtras;.SaveWebArchive (Ljava/lang/String;)V
    Could not find method android.webkit.WebView.setFindListener, referenced from method uk.co.martinpearman.b4a.webkit.WebViewExtras.SetFindListener
    VFY: unable to resolve virtual method 506: Landroid/webkit/WebView;.setFindListener (Landroid/webkit/WebView$FindListener;)V
    VFY: replacing opcode 0x6e at 0x0006
    VFY: dead code 0x0009-0009 in Luk/co/martinpearman/b4a/webkit/WebViewExtras;.SetFindListener (Landroid/webkit/WebView$FindListener;)V
    Could not find method android.webkit.WebView.showFindDialog, referenced from method uk.co.martinpearman.b4a.webkit.WebViewExtras.ShowFindDialog
    VFY: unable to resolve virtual method 517: Landroid/webkit/WebView;.showFindDialog (Ljava/lang/String;Z)Z
    VFY: replacing opcode 0x6e at 0x0006
    VFY: dead code 0x0009-000a in Luk/co/martinpearman/b4a/webkit/WebViewExtras;.ShowFindDialog (Ljava/lang/String;Z)Z
    ** Activity (main) Create, isFirst = true **
    Could not find class 'android.webkit.WebResourceResponse', referenced from method uk.co.martinpearman.b4a.webkit.DefaultWebViewClient$1.shouldInterceptRequest
    VFY: unable to resolve check-cast 136 (Landroid/webkit/WebResourceResponse;) in Luk/co/martinpearman/b4a/webkit/DefaultWebViewClient$1;
    VFY: replacing opcode 0x1f at 0x0045
    VFY: unable to find class referenced in signature (Landroid/webkit/WebResourceResponse;)
    ** Activity (main) Resume **
    HostConnection::get() New Host Connection established 0x96f6a40, tid 542
    Displayed anschi.byhtest/.main: +2s339ms
    ** Service (httputils2service) Create **
    request time failed: java.net.SocketTimeoutException: Try again
    ** Service (httputils2service) Start **
    WebViewClient1_PageStarted. URL= http://www.XXXXXXXXXXXXXXXXXXXXXXX
    VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
    VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
    Could not find method java.nio.file.Files.newOutputStream, referenced from method okio.Okio.sink
    VFY: unable to resolve static method 4427: Ljava/nio/file/Files;.newOutputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/OutputStream;
    VFY: replacing opcode 0x71 at 0x000a
    VFY: dead code 0x000d-0012 in Lokio/Okio;.sink (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Lokio/Sink;
    VFY: unable to find class referenced in signature (Ljava/nio/file/Path;)
    VFY: unable to find class referenced in signature ([Ljava/nio/file/OpenOption;)
    Could not find method java.nio.file.Files.newInputStream, referenced from method okio.Okio.source
    VFY: unable to resolve static method 4426: Ljava/nio/file/Files;.newInputStream (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Ljava/io/InputStream;
    VFY: replacing opcode 0x71 at 0x000a
    VFY: dead code 0x000d-0012 in Lokio/Okio;.source (Ljava/nio/file/Path;[Ljava/nio/file/OpenOption;)Lokio/Source;
    GC_CONCURRENT freed 748K, 49% free 3443K/6727K, external 2107K/2137K, paused 1ms+2ms
    GC_CONCURRENT freed 577K, 46% free 3749K/6855K, external 2107K/2137K, paused 1ms+9ms
    GC_EXPLICIT freed 71K, 49% free 2884K/5639K, external 5397K/6562K, paused 15ms
    WebViewClient1_PageStarted. URL= http://www.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Process anschi.byhtest (pid 542) has died.
    Scheduling restart of crashed service anschi.byhtest/anywheresoftware.b4a.samples.httputils2.httputils2service in 5000ms
    WIN DEATH: Window{b66c9170 anschi.byhtest/anschi.byhtest.main paused=false}
    Process 542 terminated by signal (11)
    Got RemoteException sending setActive(false) notification to pid 542 uid 10027
  10. warwound

    warwound Expert Licensed User

    Look at the android WebView documentation, look at the documentation for methods which are mentioned in your errors.
    For example canZoomIn.
    See this method was added to the WebView in android API level 11?
    API level 11 is android 3.0.x so this method is not available on your android 2.3 device.

    I'd guess the same applies to the other methods mentioned in your errors - i haven't got time to check though.
    An Schi and DonManfred like this.
  11. An Schi

    An Schi Well-Known Member Licensed User

    I made this summary of the webview and defaultwebviewclient errors from above logs.
    Two things here are strange to me: First i don't use any of the things in my code (like canZoomIn or setFindListener). Second strange thing is that 'WebResourceResponse' was added in API level 21, which is Android 5.0, but i don't get this errors when i run Genymotion with Android 4.1.

    Could not find method android.webkit.WebView.canZoomIn -> Added in API 11
    Could not find method android.webkit.WebView.canZoomOut -> Added in API 11
    Could not find method android.webkit.WebView.evaluateJavascript -> Added in API 19
    Could not find method android.webkit.WebView.findAllAsync -> Added in API 16
    Could not find method android.webkit.WebView.isPrivateBrowsingEnabled -> Added in API 11
    Could not find method android.webkit.WebView.removeJavascriptInterface -> Added in API 11
    Could not find method android.webkit.WebView.saveWebArchive -> Added in API 11
    Could not find method android.webkit.WebView.setFindListener -> Added in API 16
    Could not find method android.webkit.WebView.showFindDialog -> Added in API 11
    Could not find class 'android.webkit.WebResourceResponse' -> Added in API 21
    Last edited: Jul 1, 2016
  12. Intiwhiz

    Intiwhiz Member Licensed User

    @warwound , I have web application, and for access via android use webextra library and webview, but if I use filedialog from webview, there's no choice from camera phone.

    If my web application, open from browser on android, there's choice fileupload from camera.

    Have solution for this case ?

  13. ekologi

    ekologi New Member Licensed User

    Dear All, masters,
    I was been enabled using camera input in a html page using browser BUT not success using webview, requirement was to enable user to take picture and upload. Using WebViewExtras only give me access to upload file from gallery. Is there any way to accessing camera within webview?
    Thanks in Advanced
  14. Intiwhiz

    Intiwhiz Member Licensed User

    yes, i have same problem, the choice from camera didn't shown. If I use browser from android it can be shown

    Attached Files:

  15. SteveTerrell

    SteveTerrell Active Member Licensed User

  16. Erel

    Erel Administrator Staff Member Licensed User

    The wiki is no longer available. I've deleted the post.
  17. Mashiane

    Mashiane Expert Licensed User

    This is so powerful thanks a million...
  18. Leni Berry

    Leni Berry Active Member Licensed User

    Dear warwound,
    where is the library WebViewExtras2 version 2.41? i cant find the link...
  19. warwound

    warwound Expert Licensed User

    WebViewExtras (original version) was updated to version 2.41 and can be downloaded from first post in this thread.

    WebViewExtras2 latest version is 2.20 and available from here.

    There is no WebViewExtras2 version 2.41.
    eps and Leni Berry like this.
  20. DonManfred

    DonManfred Expert Licensed User

    1.42 is in Post #1. Not 2.41 ;-)
  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