📌  相关文章
📜  根据用户输入的地方获取纬度和经度 android - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:50:09.832000             🧑  作者: Mango

代码示例1
public GeoPoint getLocationFromAddress(String strAddress){

Geocoder coder = new Geocoder(this);
List
address; GeoPoint p1 = null; try { address = coder.getFromLocationName(strAddress,5); if (address==null) { return null; } Address location=address.get(0); location.getLatitude(); location.getLongitude(); p1 = new GeoPoint((double) (location.getLatitude() * 1E6), (double) (location.getLongitude() * 1E6)); return p1; } }