how to get html content from a webview?

后端 未结 12 1737
鱼传尺愫
鱼传尺愫 2020-11-22 04:29

Which is the simplest method to get html code from a webview? I have tried several methods from stackoverflow and google, but can\'t find an exact method. Please mention an

12条回答
  •  时光取名叫无心
    2020-11-22 05:09

    I suggest to try out some Reflection approach, if you have time to spend on the debugger (sorry but I didn't have).

    Starting from the loadUrl() method of the android.webkit.WebView class:

    http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/webkit/WebView.java#WebView.loadUrl%28java.lang.String%2Cjava.util.Map%29

    You should arrive on the android.webkit.BrowserFrame that call the nativeLoadUrl() native method:

    http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/webkit/BrowserFrame.java#BrowserFrame.nativeLoadUrl%28java.lang.String%2Cjava.util.Map%29

    The implementation of the native method should be here:

    http://gitorious.org/0xdroid/external_webkit/blobs/a538f34148bb04aa6ccfbb89dfd5fd784a4208b1/WebKit/android/jni/WebCoreFrameBridge.cpp

    Wish you good luck!

提交回复
热议问题