Here you can find the source of getLatLongFromAddress(String address)
Parameter | Description |
---|---|
address | represented address |
public static Address getLatLongFromAddress(String address)
//package com.java2s; import java.util.List; import android.app.Activity; import android.location.Address; import android.location.Geocoder; public class Main { public static Activity mSmartAndroidActivity; private static Geocoder geocoder; /**/* ww w . j av a 2 s . c om*/ * This method used to get latitude-longitude from address. * * @param address * represented address * @return represented {@link Address} */ public static Address getLatLongFromAddress(String address) { if (address != null && address.length() > 0) { geocoder = new Geocoder(mSmartAndroidActivity); List<Address> list = null; try { list = geocoder.getFromLocationName(address, 1); return list.get(0); } catch (Throwable e) { e.printStackTrace(); } } return null; } }