I'm using the Google Maps API v2 for android and works properly.
However, I am trying to use geocoder to get the longitude and latitude of an address, but without success.
It has changed the way to do it from the v2?
I am using the conventional code
Geocoder gc = new Geocoder(context);
//...
List<Address> list = gc.getFromLocationName("1600 Amphitheatre Parkway, Mountain View, CA", 1);
Address address = list.get(0);
double lat = address.getLatitude();
double lng = address.getLongitude();
//...
Always returns a forced shutdown, and Log solves nothing.
When using a block of try / catch, opens the map but always with the same location
Use the Internet permission, I have included in the project also COARSE_LOCATION
I have used various codes located here and on other sites, but without success.
Thank you in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…