I want to show multiple markers on a google map. My latlng
coordinates are fetched from a Parse database but I am not able see marker.
My second problem is that I want to show a title that is Restaurant Name with marker, how can I do this?
This is my code:
private class putMarker extends AsyncTask> { @Override protected ArrayList doInBackground(Void... params) { // TODO Auto-generated method stub try { Toast.makeText(getApplicationContext(), longitude + " " + latitude, Toast.LENGTH_SHORT).show(); ParseQuery query = new ParseQuery( "Details"); ParseGeoPoint myGeoPiont = new ParseGeoPoint(latitude, longitude); query.whereNear("location", myGeoPiont); query.setLimit(10); ob = query.find(); for (ParseObject resObj : ob) { ParseGeoPoint location = resObj .getParseGeoPoint("location"); restaurantName = (String) resObj.get("RestaurantName"); LatLng resLatLng = new LatLng(location.getLatitude(), location.getLongitude()); Toast.makeText(getApplicationContext(), restaurantName, Toast.LENGTH_SHORT) .show(); PiontList.add(resLatLng); } } catch (Exception e) { // TODO: handle exception } return PiontList; } protected void onPostExecute(ArrayList latlngList) { for(LatLng res: latlngList) { MarkerOptions markerOptions = new MarkerOptions(); markerOptions.position(res); markerOptions.icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_GREEN)); googleMap.addMarker(markerOptions); } } }
Please help me out.
doInbackground()
. Remove the toast – Raghunandan