MapView에서 두 가지 메소드를 변경해야하므로 확장 한 클래스를 완료했습니다. 이 클래스를 사용하려고 할 때 응용 프로그램이 충돌하고 Log : Unable to start activity. 때문에 mapViewC mapView = (mapViewC) findViewById(R.id.mapview);
내 클래스의MapView 확장하기
GameMapActivity: java.lang.ClassCastException: com.google.android.maps.MapView cannot be cast to com.lemonbyte.games.lbg.mapViewC
는 mapViewC가지도보기 {
public mapViewC(android.content.Context context, android.util.AttributeSet attrs){
super(context,attrs);
}
public mapViewC(Context context, String apiKey)
{
super(context, apiKey);
}
public mapViewC(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
}
@Override
public void dispatchDraw(Canvas canvas) {
//limit zoom level
if(getZoomLevel() >15){
getController().setZoom(15);
getController().setCenter(new GeoPoint(0, 0));
//dont draw as it will just be blank and then jump
return;
}
super.dispatchDraw(canvas);
}
}를 확장 공용 클래스가
내가 잘못 뭐하는 거지 이하? :) 고맙습니다!
또한 layout.xml 파일을 표시하십시오. –