大家好我想在我的谷歌地图上实现叠加.但是我在运行时收到致命错误,似乎是某种NullPointerException.当我删除"overlayList = mapView.getOverlays();"时,应用程序正常运行 和"overlayList.add(t);" 代码行.任何帮助是极大的赞赏!
主要活动:
public class CSActivity extends MapActivity implements LocationListener {
MapController mapController;
MapView mapView;
LocationManager locationManager;
MyLocationOverlay myLocationOverlay;
MyLocationOverlay compass;
private Button click_but;
private Button exit_but;
long start;
long stop;
int x,y;
GeoPoint touchedPoint;
Drawable d;
List<Overlay> overlayList;
String towers;
int lat;
int lng;
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.main); // bind the layout to the activity
click_but = new Button(this);
click_but = (Button)findViewById(R.id.clickBtn);
exit_but = new Button(this);
exit_but = (Button)findViewById(R.id.exitBtn);
d = getResources().getDrawable(R.drawable.markerblue);
Touchy …Run Code Online (Sandbox Code Playgroud) android google-maps nullpointerexception fatal-error android-mapview