Android的web视图,得到提交的表单数据 [英] Android, Webview, get submitted form data
本文介绍了Android的web视图,得到提交的表单数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望我的Android应用程序中使用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.
这篇关于Android的web视图,得到提交的表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文