0
我试图获取用户当前的经/纬度,使用下面的代码:获取用户当前的经/纬度
LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Location location = (Location) lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
double longitude = location.getLongitude();
double latitude = location.getLatitude();
我不断收到错误的方法getLatitude()/ getLongitude()是未定义类型地点。
我该如何解决这个问题?提前致谢。
检查你的进口,以确保您正在导入android.location.Location,而不是别的东西。 – 2012-04-15 03:07:30
我曾以某种方式导入com.amazonaws.javax.xml.stream.Location,这是不让我导入android.location.Location,因此错误。非常感谢 !! – Myxtic 2012-04-15 03:20:50