Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I had made it an app which is for food basically what I want to do is know I want to show food stores as per user location for example

Java
 if (userlocation == "RAJAPARK") {
            thencallThisfunction();
        }

 else (userlocation == "XYZ") {
Toast.makeText(getActivity(), "There is no food store around you",

}


but i am not able to match a street name with my variable and i am not getting any proper guide for doing this so plz help me

What I have tried:

I tried to get user street name and matching with my variables but it does not work
by following this link - http://javapapers.com/android/android-get-address-with-street-name-city-for-location-with-geocoding/
Posted
Updated 13-Sep-16 0:17am

 
Share this answer
 
v2
Quote:
I tried to get user street name and matching with my variables but it does not work

Using street name just feel like complicating things.
I would just use GPS user coordinates and calc distances with food shops and return only closest shops.

Distance calculation between 2 GPS coordinates is done with
Great-circle distance - Wikipedia, the free encyclopedia[^]

In order to reduce the number of distance calculations, you need a clever way of storing shops.
- The most simple way is to have all shops in a flat list, downside, you have to calculate distance to every shop every times.
- You can be more efficient by dividing the map in squares and note the square for each shop. Once you know which square you are, you just have to check shops in actual square and squares nearby.
Hilbert curve - Wikipedia, the free encyclopedia[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900