Мне нужно внести некоторые изменения в два метода в MapView, поэтому я сделал класс, который расширяет его. Когда я пытаюсь использовать этот класс, приложение выходит из строя и с Log: Unable для запуска активности.Расширение MapView
GameMapActivity: java.lang.ClassCastException: com.google.android.maps.MapView cannot be cast to com.lemonbyte.games.lbg.mapViewC
Из mapViewC mapView = (mapViewC) findViewById(R.id.mapview);
Моего класса ниже общественного класса mapViewC расширяет MapView {
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. –