I have to create a project where a list of latitude and longitude will be shown on Google maps. Those locations will come from web service. I have implemented GPS for current location, Google map. But how to put all these locations on Google map with a marker. I am little confuse on that. Code as well as ideas are welcome.
Asked
Active
Viewed 1.9k times
2
-
there are lots of example what you have tried till now? – dinesh sharma Jan 07 '14 at 11:14
-
try the following thing [for markers on map][1] [for path between two points][2] [1]: http://stackoverflow.com/questions/13763545/android-maps-api-v2-with-custom-markers [2]: http://stackoverflow.com/questions/14702621/answer-draw-path-between-two-points-using-google-maps-android-api-v2 – dinesh sharma Jan 07 '14 at 11:18
2 Answers
9
You can use this:
Layout XML:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="250dp" >
<com.google.android.gms.maps.MapView
android:id="@+id/YOURMAPID"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</com.google.android.gms.maps.MapView>
</LinearLayout>
</ScrollView>
Initialize the map:
private GoogleMap googleMap = ((MapView) rootView.findViewById(R.id.YOURMAPID)).getMap();
Set the marker:
googleMap.addMarker(new MarkerOptions().position(new LatLng( YOUR LATITUDE, -YOUR LOINGITUDE)).title("Marker"));

Bruno Pinto
- 2,013
- 3
- 23
- 33
-
Please, remember to add compile 'com.google.android.gms:play-services:11.4.2' to the app's build.gradle to have it work. – Ahmed Alnabhan Nov 13 '17 at 14:18
3
Go this Reference Link . In this site you will answer of your question.

Satyaki Mukherjee
- 2,857
- 1
- 22
- 26