【发布时间】:2016-07-08 11:45:04
【问题描述】:
【问题讨论】:
标签: android google-maps google-geocoding-api city
【问题讨论】:
标签: android google-maps google-geocoding-api city
添加此行进行城市搜索
&components=locality:ahmedabad
在特定城市内搜索地址
【讨论】:
【讨论】:
使用地理编码器
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
Geocoder geoCoder = new Geocoder(Injector.INSTANCE.getApplicationComponent().applicationContext(), Locale.getDefault());
try {
List<Address> addresses = geoCoder.getFromLocationName(
"City name", 5);
if (addresses.size() > 0) {
Log.d(TAG,"ADRESSE "+ addresses.get(0) +",LAT :" + addresses.get(0).getLatitude() +", LONG :" + addresses.get(0).getLongitude() );
}
} catch (IOException e) {
e.printStackTrace();
}
【讨论】: