Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //prints the location name
- public String getAddress(double lat, double lng, Context context) {
- Geocoder geocoder = new Geocoder(context, Locale.getDefault());
- try {
- List<Address> addresses = geocoder.getFromLocation(lat, lng, 1);
- Address obj = addresses.get(0);
- String add = obj.getAddressLine(0);
- add = add + "n" + obj.getCountryName();
- add = add + "n" + obj.getCountryCode();
- add = add + "n" + obj.getAdminArea();
- add = add + "n" + obj.getPostalCode();
- add = add + "n" + obj.getSubAdminArea();
- add = add + "n" + obj.getLocality();
- add = add + "n" + obj.getSubThoroughfare();
- Log.v("IGA", "Address" + add);
- return obj.getAddressLine(0);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- //Toast.makeText(getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
- }
- return "";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement