开发者

Reading hidden field value from webview Android

I am creating an application which has 开发者_如何学Gouser registration page. This page is loaded from the url in my webview which has submit button. After submitting form it gives the me one hidden field in the next url with userid. My problem is I want read that hidden field value from that url in to my android application.

I have tried using the following function for getting the loading page Event.

@Override
    public void onPageFinished(WebView view, String url) {
        super.onPageFinished(view, url);

        view.loadUrl("javascript:window.HTMLOUT.showHTML('<head>'+document.getElementsById('userId').innerHTML+'</head>');");
    }

Then my showHtml Method is like this

class MyJavaScriptInterface  
 {  
     @SuppressWarnings("unused")  
     public void showHTML(String html)  
     {  
        System.out.println("HTML "+html);


     }  
 }

Still I'm not able to get the data of the HTML page loaded after registering the user. Can any body please guide me what am I doing wrong here? or is this not the way should I get the data of hidden field.


You could use the 'getProgress()'-method to check if the site has loaded. After it did, you could use the 'getURL()' e.g. the 'getOriginalURL()' method to get the URL on which you can then set the Parser to read the value from your hidden field.

If this works with the Service (maybe it's a One-Time-URL, which can't be opened twice).

Anyways, what Service are you trying to code for (if it's not yours)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜