nin*_*nge 4 android location google-maps overlay
全部 - 我试图获取用户的当前位置,而不是在地图上显示覆盖项目.我的问题是用户的位置作为一个位置进入,覆盖数组只接受GeoPoints.这是我尝试过的:
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
GeoPoint point = new GeoPoint.valueOf(location);
OverlayItem overlayitem4 = new OverlayItem(point, "You Are Here", "Boulder, CO");
}
Run Code Online (Sandbox Code Playgroud)
但是我收到了一个错误GeoPoint.valueOf(location);,特别是:
GeoPoint.valueOf无法解析为类型`
所以我的问题是如何从位置转换为GeoPoint?谢谢大家的时间.
试试这个
LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
int lat = (int) (location.getLatitude() * 1E6);
int lng = (int) (location.getLongitude() * 1E6);
GeoPoint point = new GeoPoint(lat, lng);
OverlayItem overlayitem4 = new OverlayItem(point, "You Are Here", "Boulder, CO");
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8361 次 |
| 最近记录: |