我做出了一部分,按照教程来的,但是还是有错误,不知道是为什么,求大神指导
Agslocation
import com.esri.android.map.LocationService;
import com.esri.android.map.MapView;
import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.LinearUnit;
import com.esri.core.geometry.Point;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.geometry.Unit;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
public class AgsLocation {
private LocationService ls=null;
private AgsLocation agslocation=null;
public void AgsLocation(MapView mMapView) {
// TODO Auto-generated method stub
final MapView mMapView1 = null;
LocationService ls=mMapView1.getLocationService();
ls.setAutoPan(true);
ls.setAllowNetworkLocation(true);
ls.setAccuracyCircleOn(true);
ls.setLocationListener( new LocationListener(){
public void onLocationChanged(Location loc) {
// TODO Auto-generated method stub
boolean LocationChanged=false;
if(!LocationChanged){
LocationChanged=true;
double locx=loc.getLatitude();
double locy=loc.getLongitude();
Point wgspoint=new Point(locx,locy);
Point mappoint=(Point)GeometryEngine.project(wgspoint, SpatialReference.create(4326),mMapView1.getSpatialReference());
Unit mapUnit=mMapView1.getSpatialReference().getUnit();
double SEARCH_RADIUS=5.0;
double zoomWidth=Unit.convertUnits(SEARCH_RADIUS, Unit.create(LinearUnit.Code.MILE_US), mapUnit);
Envelope zoomExtent=new Envelope(mappoint,zoomWidth,zoomWidth);
mMapView1.setExtent(zoomExtent);
}
}
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
public void onStatusChanged(String provider, int status,
Bundle extras) {
// TODO Auto-generated method stub
}
});
ls.start();//开始定位
}
}
我想把它封装一下,在地图上运行不出来,是怎么回事