how to add multiple map markers in android app -


i have google map displayed complete in app. problem how add multiple map markers in app. different locations? , try coded here problem not work..

like this

import android.os.bundle; import android.support.v4.app.fragmentactivity;  import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.supportmapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.markeroptions;  public class mapsactivity extends fragmentactivity {         private googlemap mmap; // might null if google play services apk not available.      @override     protected void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_maps);         setupmapifneeded();      }       @override     protected void onresume() {         super.onresume();         setupmapifneeded();     }      private void setupmapifneeded() {          if (mmap == null) {             // try obtain map supportmapfragment.             mmap = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(r.id.map))                     .getmap();             // check if successful in obtaining map.             if (mmap != null) {                 setupmap();             }         }     }       private void setupmap() {      } } 

you can call

latlng latlng = new latlng(double_lat, double_long); mmap.addmarker(new markeroptions().position(latlng)); 

how many times want


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -