Without knowing all the details, can I suggest injecting some
javascript?

Presumably you have a WebView that's loaded some HTML.
  webView.loadUrl("http://www.bbc.co.uk";);

You could attach a Javascript object like this:
        WebView webView=(WebView)findViewById(R.id.webView);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebViewClient(new HelloWebViewClient());
        webView.addJavascriptInterface(new JavascriptBridge(this),
"bridge");

  class JavascriptBridge {
        Context context;
        public JavascriptBridge(Context context) {
                        this.context=context;
                }
        public void toastLinks(String links) {
                Toast.makeText(context, links, Toast.LENGTH_LONG).show();
        }
    }

and, once you're sure the HTML is loaded, inject some javascript which
intventories the links and returns them to your application:
    String getLinks="javascript:var links='';for
(i=0;i<document.links.length;i++) {links+=document.links[i].href+' ';}
javascript:window.bridge.toastLinks(links);";
    webView.loadUrl(getLinks);

Is that what you had in mind?

On 20 sep, 07:57, parag <parag.shetgaon...@gmail.com> wrote:
> Hi,
>
> i have html file loaded in a webview, how do i find weather there are
> more href links within this html file?
>
> thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to