• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using a marker with onLocationChanged(Location location)

 
Jared Snyder
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to utilize a marker within my override for onLocationChanged(). Presently a string is being used to post the coordinates on-screen using Toast. I'm confused by the Location Listener. What is the return? How is it passed along to the map as a marker?



Current override for onLocationChanged:

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "return value"? The method is declared void, so there is no return value.

What do you mean by "it" in "How is it passed along..."? There is no connection between this listener and your code, unless you create one. If you want to set a marker on a map as a result of this method being called, I would expect the code to call a method somewhat like "setMyMarker(location)".
 
Jared Snyder
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf, thanks for replying!

After considering my issue further, it dawned on me that my question is moot, because I don't actually need to do anything special to show a marker for the user's current location. The Google Maps v2 API offers .setMyLocationEnabled() method. When set to true, the user's current location will be placed on the map and updated accordingly. The only catch is that this is but a layer on the map and does not return the coordinates of the location. It is simply visual. That's fine, though, because I can use my method to get the coordinates.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic