【发布时间】:2013-12-07 10:42:41
【问题描述】:
我正在尝试进行 json 解析以获取城市状态和邮政编码。 我正在为此使用 google api。
我在两个设备 android 2.3 和 android 4.1.2 上调试以下代码。 在 android 2.3 中它工作正常。但在 android 4.1.2 中我得到运行时错误。
这是我的代码
String url = "http://maps.google.com/maps/api/geocode/json?address="+address+"&sensor=true";
JSONParser jparser = new JSONParser();
JSONObject jobject = jparser.getJSONFromUrl(url);
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost= new HttpPost(url);
HttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity httpEntity = httpResponse.getEntity();
is = httpEntity.getContent();
}catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
在HttpResponse httpResponse = httpClient.execute(httpPost); 行上,我收到一个运行时错误 Source not fount from ActivityThread.performLaunchActivity。
请解决我的问题
【问题讨论】:
标签: java android json google-maps