カスタム MapView を実装しようとしています。MapActivity (mainmap という名前) 内には、MapView を拡張する内部クラスがあります。
private class Lmapview extends MapView{
public Lmapview(Context context, AttributeSet attrs) {
super(context, attrs);
gestures = new GestureDetector(mainmap.this, new GestureListener(this));
}
public boolean OnTouchEvent(MotionEvent event){
return gestures.onTouchEvent(event);
}
}
次のように内部クラスを見つけるようにフォーマットされた main.xml があります。
<?xml version="1.0" encoding="utf-8"?>
<view
xmlns:android="http://schemas.android.com/apk/res/android"
class="com.mondo.tbuddy.mainmap$Lmapview"
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey=*****
/>
また、Androidmanifest.xml には適切な<uses-library android:name="com.google.android.maps"/>
エントリがあります。
アプリを実行しようとすると、(とりわけ) logcat に次のように表示されます。
ERROR/AndroidRuntime(14999): 原因: android.view.InflateException: Binary XML file line #2: Error inflating class com.mondo.tbuddy.mainmap$Lmapview
これは、logcat で見つけた次のエントリが原因です。
ERROR/AndroidRuntime(14999): 原因: java.lang.NoSuchMethodException: Lmapview(Context,AttributeSet)
私の理解が正しければ、カスタム MapView (Lmapview クラス) の適切なコンストラクターが見つからないと Android が言っているため、アプリがクラッシュしています。ただし、上記でわかるように、それは定義されており、探している署名と一致します。
誰でも私に洞察を与えることができますか?
ありがとう。