I have a custom View extending SurfaceView. The XML layout is
You don't have the correct constructor MyCustomView(Context,AttributeSet)
You must create the following constructors if you want to inflate views, and create new one in code.
use initYourStuff()
to init your stuff ;) , you can also parametrize them of course...
public MyCustomView(Context context)
{
super(context);
this.context = context;
initYourStuff();
}
public MyCustomView(Context context, AttributeSet attrs)
{
super(context, attrs);
this.context = context;
initYourStuff();
}
public MyCustomView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
this.context = context;
initYourStuff();
}