@Override
protected void onPostExecute(String message) {
super.onPostExecute(message);
items = new ArrayList<>();
JSONArray rows;
try {
json_read = new JSONObject(message);
gps = json_read.getJSONArray("rows");
for (int i = 0; i < gps.length(); i++) {
JSONObject row = gps.getJSONObject(i);
Map<String, Object> item = new HashMap<>();
String Url = "http://xxxx/getAddress.ashx?h=" +
row.getString("lat") + "," + row.getString("lng");
try {
HttpClient httpClient = new DefaultHttpClient();
HttpGet get = new HttpGet(Url);
HttpResponse response = httpClient.execute(get);
HttpEntity resEntity = response.getEntity();
//Address = EntityUtils.toString(resEntity);
item.put("address", EntityUtils.toString(resEntity));
} catch (Exception e) {
item.put("address", e.toString());
}
items.add(item);
}
} catch (JSONException e) {
e.printStackTrace();
}
会报android.os.NetworkOnMainThreadException
请问大概要怎么解
谢谢