这是百度官方的开发者指南里的初始化LocationClient类的代码:
public LocationClient mLocationClient = null;
public BDLocationListener myListener = new MyLocationListener();
public void onCreate() {
mLocationClient = new LocationClient(getApplicationContext()); //声明LocationClient类
mLocationClient.registerLocationListener( myListener ); //注册监听函数
}
其中,MyLocationListener()在eclipse中提示错误:
MyLocationListener cannot be resolved to a type MainActivity.java 我用的是V3.3的定位SDK,仔细检查过确保所有要求的都import了。百度SDK
public LocationClient mLocationClient = null;
public BDLocationListener myListener = new MyLocationListener();
public void onCreate() {
mLocationClient = new LocationClient(getApplicationContext()); //声明LocationClient类
mLocationClient.registerLocationListener( myListener ); //注册监听函数
}
其中,MyLocationListener()在eclipse中提示错误:
MyLocationListener cannot be resolved to a type MainActivity.java 我用的是V3.3的定位SDK,仔细检查过确保所有要求的都import了。百度SDK
新建libs目录把 jar包丢进去 ---add to build path