Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - how to search for starbucks on map?

how to search for starbucks on map?

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

how to search for starbucks on map?

Postby djmason9 » Tue Feb 23, 2010 11:51 pm

This may be a dumb question but all i need to do is show the starbuck or coffee shops in my location.. So far I can use
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. List<Address> addresses = geoCoder.getFromLocationName("SFO", 5);
Parsed in 0.010 seconds, using GeSHi 1.0.8.4
to get major things like airports or landmarks but if i put starbucks i get nothing. Am i missing something? My goal is to show any coffee shops in my current area..

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. @Override
  2.  
  3.         public void onCreate(Bundle icicle) {
  4.  
  5.                 super.onCreate(icicle);
  6.  
  7.                 requestWindowFeature(Window.FEATURE_NO_TITLE);
  8.  
  9.                 setContentView(R.layout.main);
  10.  
  11.                 // Get the map view from resource file
  12.  
  13.                 mapView = (MapView) findViewById(R.id.mapview);
  14.  
  15.                 mapView.setBuiltInZoomControls(true);
  16.  
  17.                
  18.  
  19.                 LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
  20.  
  21.                 Criteria criteria = new Criteria();
  22.  
  23.                 criteria.setAccuracy(Criteria.ACCURACY_FINE);
  24.  
  25.                 criteria.setAltitudeRequired(false);
  26.  
  27.                 criteria.setBearingRequired(false);
  28.  
  29.                 criteria.setCostAllowed(true);
  30.  
  31.                 criteria.setPowerRequirement(Criteria.POWER_LOW);
  32.  
  33.                 String provider = locationManager.getBestProvider(criteria, false);
  34.  
  35.                 Location location = locationManager.getLastKnownLocation(provider);
  36.  
  37.                 updateWithNewLocation(location);
  38.  
  39.                 locationManager.requestLocationUpdates(provider, 2000, 10, locationListener);
  40.  
  41.  
  42.  
  43.                 mc = mapView.getController();
  44.  
  45.                 p =
  46.  
  47.                         new GeoPoint(
  48.  
  49.                                 (int) (locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLatitude() * 1000000),
  50.  
  51.                                 (int) (locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER).getLongitude() * 1000000));
  52.  
  53.                 mc.setZoom(14);
  54.  
  55.                 mc.animateTo(p);
  56.  
  57.                 try {
  58.  
  59.                         Geocoder geoCoder = new Geocoder(this, Locale.getDefault());
  60.  
  61.                         List<Address> addresses = geoCoder.getFromLocationName("SFO", 5);
  62.  
  63.                         if (addresses.size() > 0) {
  64.  
  65.                                 p = new GeoPoint((int) (addresses.get(0).getLatitude() * 1E6), (int) (addresses.get(0).getLongitude() * 1E6));
  66.  
  67.                                
  68.  
  69.                                 MapOverlay mapOverlay = new MapOverlay();
  70.  
  71.                                 List<Overlay> listOfOverlays = mapView.getOverlays();
  72.  
  73.                                 listOfOverlays.clear();
  74.  
  75.                                 listOfOverlays.add(mapOverlay);
  76.  
  77.                                
  78.  
  79.                                 mc.animateTo(p);
  80.  
  81.                                 mapView.invalidate();
  82.  
  83.                         }
  84.  
  85.                 } catch (IOException e) {
  86.  
  87.                         e.printStackTrace();
  88.  
  89.                 }
  90.  
  91.                
  92.  
  93.         }
Parsed in 0.012 seconds, using GeSHi 1.0.8.4



Darren
djmason9
Freshman
Freshman
 
Posts: 3
Joined: Tue Feb 23, 2010 11:38 pm

Top

Postby carlrice » Sun May 02, 2010 10:33 pm

any luck with this? i am trying to do a general query of businesses in the area and can't seem to get anything back. list always returns null/0 result.
carlrice
Freshman
Freshman
 
Posts: 5
Joined: Tue Feb 16, 2010 4:14 am

Postby mooy » Sat May 15, 2010 7:50 pm

I dont think this is the right method:
Geocoder.getFromLocationName(String locationName, int maxResults)
Returns an array of Addresses that are known to describe the named location, which may be a place name such as "Dalvik, Iceland", an address such as "1600 Amphitheatre Parkway, Mountain View, CA", an airport code such as "SFO", etc..

Gives adresses to known places, not Starbucks.

I tried to use:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:56.770387,14.809570?q=resturants"));
  3.  
  4. startActivity(intent);
  5.  
  6.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4

http://developer.android.com/guide/appe ... tents.html

and that gave me a map and pins. Probably not what you were looking for but...
I have a similar problem.
mooy
Freshman
Freshman
 
Posts: 7
Joined: Tue Apr 27, 2010 3:14 pm

Postby carlrice » Sat May 15, 2010 7:54 pm

I ended up using JSON results from Google Maps web service by passing in lat/long and my query. In the end, it worked out perfect for my app since all I needed was text and the first closest result (all of which specified in my query, making it more flexible)
carlrice
Freshman
Freshman
 
Posts: 5
Joined: Tue Feb 16, 2010 4:14 am

Re: how to search for starbucks on map?

Postby ranjan » Tue Jun 01, 2010 2:55 pm

I need a solution for this. I cant use uri.parse method as it will not work under tab.

So I have to use mapview, but how will I do it. Geocoder is not giving correct results as I am not providing any address.

Please, help me out.

Thanks
Ranjan
ranjan
Developer
Developer
 
Posts: 35
Joined: Tue Nov 03, 2009 3:29 pm

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 7 guests