I want to build an app which will display restaurants stored in a database (name, lat, long etc...) on a map within certain radius from the user. The user can then click on a particular restaurant to view more information or add a review about that restaurant. I know how to fetch the name of restaurants from the database using JSON and PHP and display them in a list view. But I want to be able to display them on a map. Could someone please point me in the correct direction on how to get this done?
Asked
Active
Viewed 230 times
-1

Phantômaxx
- 37,901
- 21
- 84
- 115

Abhilash Karanth
- 1
- 3
-
2Please post your efforts for SO members to help you better. – Bussller Nov 15 '18 at 09:39
-
See this project on [Github](https://github.com/NeilSayok/Car-Locator-System). It does something like you say. It Locates car instead of restruants. – Sayok Majumder Nov 15 '18 at 10:12
-
@SayokMajumder sir, can you please share .sql file. – Abhilash Karanth Nov 15 '18 at 11:11
-
@AbhilashKaranth I don't have any specific sql files for the project. The database are hosted online and details are put inside webfiles. – Sayok Majumder Nov 15 '18 at 11:27
1 Answers
0
Try this.. it will show the marker for that location
MarkerOptions mp = new MarkerOptions();
LatLng newLatLng = new LatLng(lat, lng); // latitude and longitude
mp.position(newLatLng);
mp.icon(BitmapDescriptorFactory.fromResource(R.drawable.your_icon));
mp.title("Title");
mp.snippet(location); // location
googleMap.addMarker(mp);

veerendran
- 169
- 1
- 4
-
sir, latitude and longitude of that location should be reflected from mysql database. Suppose a restaurant registered with us and we have to show their details if it is nearer to user while he is searching. I am looking for this kind of code – Abhilash Karanth Nov 15 '18 at 11:09
-
Okay Sir, You have list of restaurants details with location in your db. if user going to search restaurant means at the time you can the get current location of the user. Now calculate the distance with restaurant locations, filter out the restaurant list send to app. app will show all the restaurants on map. – veerendran Nov 15 '18 at 11:34
-
yes sir, i am trying to find out solution for above task. But still didn't get the desired output – Abhilash Karanth Nov 15 '18 at 11:39