试图获取android手机的更新位置,但代码给我带来了问题

问题描述

|| 我正在尝试定期更新手机的位置,但是我的代码出现了一些错误。这里是:
LocationManager locm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); 
Location location = locm.getLastKnownLocation(LocationManager.GPS_PROVIDER);

double longitude = location.getLongitude();
double latitude = location.getLatitude();



private final LocationListener locationListener = new LocationListener() {
    public void onLocationChanged(Location location) {
        longitude = location.getLongitude();
        latitude = location.getLatitude();
    }

    locm.requestLocationUpdates(LocationManager.GPS,2000,10,locationListener);
        // error here : Syntax error on token(s),misplaced constructs
关键是,当我取出最后一行代码时,代码中没有错误。有人可以帮我吗?任何帮助将非常感激。     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)