2012-12-04 72 views

回答

1

試試這個

Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault()); 
String textToSearch = searchText.getText().toString(); 
List<Address> fromLocationName = null; 
fromLocationName = geocoder.getFromLocationName(texToSearch, 1); 
if (fromLocationName != null && fromLocationName.size() > 0) { 
    Address a = fromLocationName.get(0); 
    GeoPoint point = new GeoPoint(
         (int) (a.getLatitude() * _1E6), 
         (int) (a.getLongitude() * _1E6)); 
}