java can接受发送数据,如何从Web服务器发送接收数据?请

Hello,

These days I was trying to make some app for Android. App that send three Strings to web server, and receive a medium size amount of data.

I know how can i do this, but i need an explanation for server side, so here is my question.

Should I organize data on web server as Database or XML? Should I use PHP to get data from Database and send it to an app, or should I put data in XML file and read it then create HTML file with XSLT and send to that HTML file to an app?

Tell me the best way to do it, i searched on google but i could not find good explanation. Or correct me if I am wrong, I am just a student.

In my app, I can show to user data in list, or in WebView all the same...

Thanks!

解决方案

Hi Nemanja,

I will explain the steps...

Its better to use JSON format for data transfer, because its very readable...

The database should be in a Server, which can be accessed by Web Service or WCF...

1. The database should be placed in a server which can be accessed by Webservice / WCF.

2. Create a small WCF or Webservice to access the data from other remote application.

3. The webservice can export the data in JSON format which is easier (you can get many json serialize and deserializ classes) for reading and populating Listview or Grid etc.

4. you can access the data from your Android app by calling this webservice and converting to List items with the help of Java JSON serializer and De-serializer classes.

5. After converting to List view its very easy to pass to custom adapter or default adapter for Listview..

please let me know is this explanation is ok or need any help...

Thanks,

Ullas Krishnan

Hi,

Please see the below link for the JSON String to Listview

http://codeoncloud.blogspot.in/2013/07/how-to-populate-android-list-view-from.html[^]

Create a REST FULL service in Java...

http://crunchify.com/create-very-simple-jersey-rest-service-and-send-json-data-from-java-client/[^]

I am a C# developer creating Application in Xamarin, so dont have any sampl example in Java.

Have WCF and C# Android Samples....

Thanks,

Ullas Krishnan

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值