Guest User

Untitled

a guest
Jun 21st, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. &components=locality:ahmedabad
  2.  
  3. import android.location.Address;
  4. import android.location.Geocoder;
  5. import android.location.Location;
  6.  
  7. Geocoder geoCoder = new Geocoder(Injector.INSTANCE.getApplicationComponent().applicationContext(), Locale.getDefault());
  8. try {
  9. List<Address> addresses = geoCoder.getFromLocationName(
  10. "City name", 5);
  11.  
  12. if (addresses.size() > 0) {
  13. Log.d(TAG,"ADRESSE "+ addresses.get(0) +",LAT :" + addresses.get(0).getLatitude() +", LONG :" + addresses.get(0).getLongitude() );
  14. }
  15. } catch (IOException e) {
  16. e.printStackTrace();
  17. }
Add Comment
Please, Sign In to add comment