• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

android location loading weird locations

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so im currently trying to develop an android app that takes pics of trees and marks them on a map in the users location. im having 1 problem with my locations. Every time i boot up the app it shows a location i have never been to. infact everytime i start the app it shows me at the rose bowl , which i have never been to lol. somtimes it will also show me at my house when im at school. i have no idea how to correct this. if i hit the my location button it finds my current location and everything works fine. its just that initial load were it loads some random location for me. my code for the location is below. id like it to initially load my current location when the app boots up, is this possible?

 
Ranch Hand
Posts: 314
2
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This happened to me too -- I'd start my app and find myself positioned somewhere over Africa or something. The way I solved it was to set the bounds of my map in the onMapLoaded method as follows:



Are you able to do something similar in your map?

Darryl

NB: I found that if you try animating your camera to a single coordinate on the map, the camera would be so low to the ground after animation that you can't really see anything of the surrounding area. So if you're working with a single coordinate instead of a bounded area of two or more coordinates, you might also want to set your zoom level to a value that allows for appropriate viewing of the surrounding area.
 
Darryl A. J. Staflund
Ranch Hand
Posts: 314
2
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again,

I just learned of an easier way of doing this and wanted to post it here. If you've defined your map using a fragment similar to the following:



then you can declaring the starting map position right in the fragment definition as in the following:



Very nice!

Darryl
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic