0

How do I get the coordinates(latitude and longitude) that are saved in mysql and show them in maps as markers? I have already set up a connection and it is working. Only problem is showing them in a map, rest all procedures are fine.

Man HOOD
  • 51
  • 1
  • 1
  • 6
  • What have you done so far? Do you have a GoogleMap instance that you can work with? – StuStirling Apr 11 '15 at 11:15
  • Yes I need to work with Google maps. I have created an external db using php and populated it in a list view. It contains some text data and an image view, the image view when clicked opens google maps. Each click on the imageview items of the listview should provide a different marker location based on the double values of longitude and latitude that I have created using set and get method. For example: you have a list of restaurants and each item of the list view when clicked provides u a different marker location in Google map – Man HOOD Apr 11 '15 at 11:30

1 Answers1

0

If you managed to retrieve coordinate data from the database and you have all the coordinates available when your map is ready, you can use GoogleMap#addMarker.

If you don't have the coordinates, please post what you have done so far.

Edit: How to open Google Maps with specific location

If your goal is to open Google Maps with specific location, then you can use geo:latitude,longitude?z=zoom Uri for your Intent.

Example code:

// Creates an Intent that will load a map of San Francisco
Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4194");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
Rax
  • 785
  • 4
  • 14
  • I have all the coordinates in the external dB. I just need to call an intent that opens Google maps when clicked on an image view of a listview and provide marker that gets the latitude and longitude from the get method to Google maps. – Man HOOD Apr 11 '15 at 11:41
  • Updated the answer. Lemme know if that's what you're looking for. – Rax Apr 11 '15 at 12:12
  • That's for one location. How about u have many locations and u want to specify each one of them in a list view that when the user clicks on one of the of the listview, he gets location of that place ? – Man HOOD Apr 11 '15 at 12:22
  • Step 1: Show dialog with list of items. [This is how](http://stackoverflow.com/a/15762955/604069). Step 2: handle click event on the list dialog and launch Google Maps intent based on selected item. – Rax Apr 11 '15 at 12:27