Java eclipse位置编码错误

时间:2014-02-04 23:18:48

标签: java android eclipse

在LOCATIONLISTENER下获得LED线(LOCATIONLISTENER无法解析为一种类型) 请看一看。我从GOOGLE开发者网站上看到了这种方法。谢谢

“package com.xxxxxxx;

    import com.google.android.maps.MapActivity;
    import android.app.Activity;
    import android.content.Context;
    import android.location.Location;
    import android.location.LocationManager;
    import android.os.Bundle;
    import android.view.View;

    public class MainActivity<MapController> extends MapActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Acquire a reference to the system Location Manager
    LocationManager locationManager = (LocationManager) this.getSystemService 
   (Context.LOCATION_SERVICE);

    // Define a listener that responds to location updates
    LocationListener locationListener = new LocationListener() {
        public void onLocationChanged(Location location) {
          // Called when a new location is found by the network location provider.
          makeUseOfNewLocation(location);
        }

        public void onStatusChanged(String provider, int status, Bundle extras) {}

        public void onProviderEnabled(String provider) {}

        public void onProviderDisabled(String provider) {}
         };

        // Register the listener with the Location Manager to receive location updates
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,  
         locationListener);
           }

protected void makeUseOfNewLocation(Location location) {
    // TODO Auto-generated method stub

}

@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}
       }"

在LOCATIONLISTENER下获得LED线(LOCATIONLISTENER无法解析为一种类型) 请看一看。我从GOOGLE开发者网站上看到了这种方法。致谢

1 个答案:

答案 0 :(得分:4)

import android.location.LocationListener;添加到您的导入列表中。

此外,您的CAPS LOCK键似乎已被破坏。你可能想要一个新的键盘。