更新时间:2023-11-22 22:01:52
一个HttpClient的可以让你您的应用程序中调用任意网址:
A HttpClient will allow you to call an arbitrary URL within your app:
DefaultHttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http;//91.9.91.91:?1");
HttpResponse response = client.execute(request);
不要忘了在尝试捕捉到,虽然包装
Don't forget to wrap in a try catch though.
编辑:
new Thread(){
public void run(){
try{
DefaultHttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http;//91.9.91.91:?1");
HttpResponse response = client.execute(request);
}catch(Exception e){
// Handle the exception
e.printStackTrace();
}
}
};