Java tutorial
//package com.java2s; //License from project: LGPL import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.params.BasicHttpParams; import org.apache.http.util.EntityUtils; import android.util.Log; public class Main { public static String reverseGeocode(String url) { try { HttpGet httpGet = new HttpGet(url); BasicHttpParams httpParams = new BasicHttpParams(); DefaultHttpClient defaultHttpClient = new DefaultHttpClient(httpParams); HttpResponse httpResponse = defaultHttpClient.execute(httpGet); int responseCode = httpResponse.getStatusLine().getStatusCode(); if (responseCode == HttpStatus.SC_OK) { String charSet = EntityUtils.getContentCharSet(httpResponse.getEntity()); if (null == charSet) { charSet = "UTF-8"; } String str = new String(EntityUtils.toByteArray(httpResponse.getEntity()), charSet); defaultHttpClient.getConnectionManager().shutdown(); Log.i("-----------", "str = " + str); return str; } } catch (Exception e) { e.printStackTrace(); } return null; } }