0
A
回答
0
得到当前的经纬度使用:LocationManager
LocationManager locationmanager = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria cr = new Criteria();
String provider = locationmanager.getBestProvider(cr, true);
Location location = locationmanager.getLastKnownLocation(provider);
if (location != null) {
double lat=location.getLatitude();
double lng=location.getLongitude();
}
通当前的经纬度到下面的方法将返回您解决!
public List<Address> getAddress(double latitude, double longitude) {
List<Address> addresses = null;
try {
Geocoder geocoder;
geocoder = new Geocoder(youractivityname.this);
if (latitude != 0 || longitude != 0) {
addresses = geocoder.getFromLocation(latitude, longitude, 1);
//testing address below
String address = addresses.get(0).getAddressLine(0);
String city = addresses.get(0).getAddressLine(1);
String country = addresses.get(0).getAddressLine(2);
Log.d("TAG", "address = " + address + ", city =" + city
+ ", country = " + country);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
// Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
return addresses;
}
0
首先你必须要找到你的位置,所以按照这个帖子: Current location这里Current location。
然后找到的地方,看看这里 List of places around user
相关问题
- 1. 如何在android google maps api V2中获取当前位置?
- 2. 如何在google map v2中获取当前位置信息?
- 3. 如何在Google Maps Android API v2中获取当前位置?
- 4. 如何获得GMAPS API V3的当前经纬度位置?
- 5. Gmaps - 当前位置移动多线制
- 6. GMaps V2回弹到原始位置
- 7. 如何获取当前的GPS位置?
- 8. 如何获取当前位置android?
- 9. 如何获取当前的iScroll位置?
- 10. 如何获取用户当前位置
- 11. 如何获取当前位置
- 12. 使用Google Maps API v2获取当前位置为TEXT
- 13. 谷歌地图V2的Android获取当前位置
- 14. 获取当前位置
- 15. Android获取当前位置
- 16. android获取当前位置
- 17. 获取当前位置android
- 18. 获取当前位置
- 19. 获取当前位置
- 20. 获取当前位置ImageView
- 21. 获取当前位置
- 22. CLLocation当前位置获取位置
- 23. 如何从位置管理器获取当前位置?
- 24. Android位置 - 如何获取当前位置并避免nullpointerexception
- 25. Google Maps Android API v2和当前位置
- 26. Android Google Maps Api v2当前位置Null
- 27. 如何在android中获取前景的当前位置?
- 28. 谷歌地图V2找到,如果当前位置位于圆
- 29. 如何获取Android中当前位置的纬度和经度?
- 30. 如何创建当前位置的链接(google map v2,android)
列表
和passangerHome.this是未知的。? –passangerHome.this = youractivityname.this –
import java.util.List; –