我的Android应用程序有问题。我尝试从php web服务的json数据中绘制谷歌地图v1中的多个地图引脚。当我尝试绘制它时,在地图中没有显示任何内容。
这是我的代码
class MapPOI extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String... args) {
// TODO Auto-generated method stub
//mendapatkan data dari database berupa alamat, konteks, latitude, longitude
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("lat", Double.toString(latPengguna)));
params.add(new BasicNameValuePair("lng", Double.toString(lngPengguna)));
params.add(new BasicNameValuePair("konteks", konteksCocok));
Log.d("lat dan lng kirim", "data: " + Double.toString(latPengguna) + " " + Double.toString(lngPengguna));
Log.d("konteks kirim", "data: " + konteksCocok);
JSONObject json = jParser.makeHttpRequest(url_webservice, "POST", params);
jsonRsponse = json.toString();
Log.d("data json: ", jsonRsponse);
return null;
}
}
protected void onPostExecute(String file_url) {
MapMarker mapMarker = null;
List<Overlay> mapOverlay = null;
//menggambar poi ke peta
try {
JSONArray jArray = new JSONArray(file_url);
for(int i = 0; i < jArray.length(); i++) {
JSONObject c = jArray.getJSONObject(i);
JSONObject d = c.getJSONObject("point");
latDB = d.getString(TAG_LAT);
lngDB = d.getString(TAG_LNG);
alamat = d.getString(TAG_ALAMAT);
konteks = d.getString(TAG_KONTEKS);
Log.d("latDB", "data: " + latDB);
Log.d("lngDB", "data: " + lngDB);
Log.d("altDB", "data: " + alamat);
Log.d("ktsDB", "data: " + konteks);
latDBInt = Integer.parseInt(latDB);
lngDBInt = Integer.parseInt(lngDB);
GeoPoint p = new GeoPoint((int) (latDBInt * 1E6), (int) (1E6 * lngDBInt));
mapOverlay = POIMap.getOverlays();
Drawable draw = this.getResources().getDrawable(R.drawable.map_pin);
mapMarker = new MapMarker(draw, this);
OverlayItem overlayItem = new OverlayItem(p, alamat, konteks);
mapMarker.AddOverlay(overlayItem);
}
mapOverlay.add(mapMarker);
} catch(JSONException ex) {
ex.printStackTrace();
}
}
任何人都可以帮忙??