HttpClient from apache in Android?

耗尽温柔 提交于 2019-12-25 05:38:13

问题


I already have developed an desktop application using Java and now I need to develop the same application to Android. In my java application I've used the httpclient library from apache to make all http transactions, my question is: Can I use the same class HttpUtil that I've used in my java application with HttpClient in my new Android app ???


回答1:


Yes. Much, most, or all of your code can work in Android. Just make sure to continue using the Apache imports and not Google's (near) equivalents.

For example, instead of:

import com.google.api.client.http.HttpResponse;

Make sure you continue to use this:

import org.apache.http.HttpResponse;


来源:https://stackoverflow.com/questions/15537731/httpclient-from-apache-in-android

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