0

私はこのコードを持っています:

package sig;

import org.json.JSONObject;

public class MyService extends java.lang.Object{

    public JSONObject getLocationInfo( double lat, double lng) {

        HttpGet httpGet = new HTTP("http://maps.google.com/maps/api/geocode/json?latlng="+lat+","+lng+"&sensor=false");
        HttpClient client = new DefaultHttpClient();
        HttpResponse response;
        StringBuilder stringBuilder = new StringBuilder();

        try {
            response = client.execute(httpGet);
            HttpEntity entity = response.getEntity();
            InputStream stream = entity.getContent();
            int b;
            while ((b = stream.read()) != -1) {
                stringBuilder.append((char) b);
            }
        } catch (ClientProtocolException e) {
            } catch (IOException e) {
        }

        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject = new JSONObject(stringBuilder.toString());
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return jsonObject;
    }
}

しかし、それはエラーですHttpGet, 使用するためにどのライブラリを使用する必要がありますHttpGetか , ありがとうございます!

4

1 に答える 1