Android的web视图,得到提交的表单数据视图、表单、数据、Android

由网友(葒顔╰潙誰痴)分享简介:我希望我的Andr​​oid应用程序中使用web视图来显示一个HTML表单。当用户presses提交按钮,它要发回给我的程序的名称/值对。如何做到这一点?I want my Android application to use Webview to display an html form. When the use...

我希望我的Andr​​oid应用程序中使用web视图来显示一个HTML表单。当用户presses提交按钮,它要发回给我的程序的名称/值对。如何做到这一点?

I want my Android application to use Webview to display an html form. When the user presses the Submit button, it want the name/value pairs sent back to my program. How do I do this?

我已经看过其他类似的问题,但没有答复的告诉怎么样,具体而言,要做到这一点。

I have looked at other similar questions but not of the responses tell how, specifically, to do this.

推荐答案

我已经找到了我需要的。如果我在HTML表单设置行为=形,那么我可以拦截的行动:

I have found what I needed. If I set action='FORM" in the form html, then I can intercept the action with:

        public void onLoadResource (WebView view, String url){
        int index = url.indexOf("FORM?");
        if (index != -1){
            String d = URLDecoder.decode(url.substring(index+5));
        }
    }

名称/值对的字符串ð。

The name/value pairs are in String d.

阅读全文

相关推荐

最新文章