Connect Android application to remote data

三世轮回 提交于 2020-01-23 13:16:05

问题


Sheesh talk about limited information! I'm trying to get my Android application to connect to an online database to access information. There's quite a bit of info including geotags and these are going to be mapped on my app. The developer site has the very informative piece of information:

You can use the network (when it's available) to store and retrieve data on your own web-based services. To do network operations, use classes in the following packages:

java.net.*
android.net.*

Like I said in my previous question, I'm still very much an android newbie, and trying to remember my java oop from college is slow. Does anyone have an example of how this might work, or how I could implement it? I wouldn't mind even connecting to a local xml file, if I could find a good example of how to do that!? Am I just looking in all the wrong places?!

Help. Please!

T


回答1:


You can use SAXParser to parse XML from the net. Here's a tutorial on how to use the same.




回答2:


How do you plan to connect to the database?

Android allows you do to plain socket communication which you can refresh your knowledge of here:

http://java.sun.com/developer/onlineTraining/Programming/BasicJava2/socket.html

Another method would be to put up a REST type service and respond with XML. SAX is commonly used for XML parsing in Android:

http://www.saxproject.org/



来源:https://stackoverflow.com/questions/2998468/connect-android-application-to-remote-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!