简体   繁体   English

在Android中从服务器获取和发送数据的最佳方法

[英]Best Approach to get & send data from server in Android

Hi i am a iPhone developer and new to android. 嗨,我是iPhone开发人员,也是android的新手。 I want to know a best approach in android to make a http connection and get the response from server and (like iOS there are connectionDidFinish, connectionDidFail methods) i want to show a loader when connection is start and when connection is complete then i dismiss the loader. 我想知道一个最好的方法在android中建立一个http连接并从服务器获取响应,(像iOS一样有connectionDidFinish,connectionDidFail方法)我想在连接开始和连接完成时显示一个加载器,然后关闭装载机。 how to do that. 怎么做。

I read about HttpConnection, HttpURLConnection, DefaultHttpClient but i am too confuse that which is best approach and how to use them and one more thing connection is like a asynchronous connection. 我读了有关HttpConnection,HttpURLConnection,DefaultHttpClient的信息,但我太困惑了,这是最好的方法以及如何使用它们,还有一件事是异步连接。

one more thing i want to make two or more connection so that i have to differentiate between them also so suggest me that also? 我还想建立两个或多个连接,以便我必须区分它们,所以也建议我这样做吗?

要显示和关闭加载程序(即ProgressBar或ProgressDialog),请实现AsyncTask (在Android中称为无痛线程 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM