why my app crashes when I use extended view
Here is my extended view
public class CustomView extends View
{
CustomView(Context c)
{
super(c);
init(null);
}
CustomView(Context c, AttributeSet attr)
{
super(c, attr);
init(attr);
}
public void init(AttributeSet attr)
{
}
@Override
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
}
}
This is the layout file
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<com.mycompany. LearnCanvas.CustomView
android:layout_width="match_parent"
android:layout_height="200dp"/>
</LinearLayout>
When I run my app, it crashes.