0

この機能に問題があります:

JSONObject result = GeolocalisationHelper.getMapLocationInfo("Ingré");

public static JSONObject getMapLocationInfo(String address) {

    HttpGet httpGet = new HttpGet("http://maps.google.com/maps/api/geocode/json?address=" +address+"&ka&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) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return jsonObject;
}

LogCat では、結果は次のようになります。 ここに画像の説明を入力

都市名のエンコーディングの問題が見られます...

私を手伝ってくれますか ?ありがとう !

編集済み

4

0 に答える 0