I write a simple extend view class,the code is following:
public class MyView extends View
{
public MyView(Context context)
{
super(context);
}
public MyView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
protected void OnDraw(Canvas canvas)
{
super.onDraw(canvas);
}
}
XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.main.sufaceview.MyView
android:id="@+id/myview"
android:layout_width="300dp"
android:layout_height="300dp"
android:background="@drawable/tt"/>
</RelativeLayout>
When entry the virtual machine. It shows the breakdown:

why this is? i think the custom view should very easy.I did not add other code,it has the error.
Edit:the logcat displays:

I think you need another constructor, at least, thats what I read in other posts.