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