Tuesday, April 9, 2013

[android help] how to fetch the area location on the google map using longitutte and latitude in android?


Code show location on Google Maps when you have longitude and latitude



Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:0,0?q=" + latitude + "," + longitude));
startActivity(intent);


Fetch area location : For example: NewYork City...



try {
Geocoder gCoder = new Geocoder(getApplicationContext());
ArrayList
addresses = (ArrayList
) gCoder
.getFromLocation(latitude, longitude, 1);
if (addresses != null && addresses.size() > 0) {

Log.d(addresses.get(0)
.getThoroughfare()
+ " "
+ addresses.get(0).getSubAdminArea()
+ " "
+ addresses.get(0).getAdminArea()
+ ", "
+ addresses.get(0).getCountryName());
}
} catch (Exception e) {
// TODO: handle exception
}


.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...