porivate void sendRequestWithHttpURLConnection(){
new Thread(new Runnable(){
@override
public void run(){
HttpURLConnection connection = null;
try{
URL url = new URL("http://....");
connection = (HttpURLConnection
)url.openConnection();
connection.setRequestMethods("GET");
connection.setConnectionTimeout(8000);
connection.setReadTimeout(8000);
InputStream in = connection.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuilder respone = new StringBuilder();
String line;
while((line = reader.readLine()) != null){
respone.append(line);
}
}
}
}).start();
}
private void sendRequsetWithHttpClient(){
new Thread(new Runnable(){
@overide
public void run(){
try{
HttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(....);
HttpResponse httpResponse = httpClient
.execute(httpGet);
if(httpResponse .getStatusLine().getStatusCode() == 200){
HttpEntity entity = httpResponse.getEntity();
String response = EntityUtils.toString(entity,"utf-8");
}
}
}
}).start();
}