要说Android网络通讯平台支持还是比较丰富的,除了兼容J2ME中的java.net api外还提供了一些Android平台独有的类android.net这个Package,似乎更强大的是org.apache.http类,这个是阿帕奇实验室开源的包,对于Http请求处理很方便,常见的有很多方法,同时在android m5-0.9r1中改变的也很多,来一起看看吧:
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpVersion;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.params.HttpParams;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpProtocolParams;
有关详细的例子还可以参考apache web server官方文档 http://hc.apache.org/httpcomponents-client/examples.html
RSS