当地的Andr​​oid服务接收本地网页数据 [英] Local android service receive data from local web page

查看:108
本文介绍了当地的Andr​​oid服务接收本地网页数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Android平板电脑脱机网页。

I have offline web page on android tablet.

是否有可能写的Andr​​oid服务,将会从网页中获取数据,当用户插入数据并提交,并在Android的服务接收数据比它要保存在文本文件或数据库。

Is it possible to write android service which will get data from web page when user insert data and submit it, and when android service receive data than it has to save it in text file or db.

一切都处于离线本地模式。

Everything is in offline local mode.

推荐答案

您使用这个词的服务除了Android的。人们可能会得到你taliking有关,因为它有针对Android特殊的含义什么拨错的想法。

You should be carful when using the word Service besides android. People might get a worng idea of what you're taliking about because it has a special meaning for android.

由于本地网页将提交一个POST请求到一定的URL,你的设备实际上是不是你会失败,并在网络服务器。但是你可以利用JavaScript / JSON桥到本地的HTML完成你的任务。见<一href=\"http://stackoverflow.com/questions/3664440/android-how-to-intercept-a-form-post-in-android-webviewclient-on-api-level-4/3922941#3922941\">this帖子怎么看。

Because a local webpage will submit a post request to a certain URL and your device is actually not the webserver you will fail with that. But you can accomplish your task with a javascript/JSON bridge to your local HTML. See this post to see how.

的想法是要使用的收集所需的数据和由JavaScript桥而不是数据从提交的URL submiting到其返回到网页视图点击处理程序。从Java方的WebView您可以用JSON对象作出回应。

The idea is to use a click handler which collects the needed data and returns it to the webview by the javascript bridge instead submiting the data to a from submit URL. From java side to WebView you can respond with an JSON object.

要做到这一点,你需要有关于 HTML和JavaScript的基础知识并了解使用的<一个HREF =htt​​p://developer.android.com/reference/android/webkit/WebView.html相对=nofollow>的WebView 。

To accomplish this you need to have fundamental knowledge about HTML and javascript and understand the use of a WebView.

这篇关于当地的Andr​​oid服务接收本地网页数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆