problem with the custom ui
<p>I am trying to use a custom view for my application. 
  When I run the program it gives me an error something like this</p>

<pre><code> java.lang.RuntimeException: Unable to start activity ComponentInfo{com.game.subgame/com.game.subgame.BoardActivity}: 
  android.view.InflateException: Binary XML file line #6: Error inflating class com.game.brainer.Board
</code></pre>

<p>Not sure what I am missing here.</p>

<p>What I want to do is - use the Board view class in my BoardActivity Activity.</p>

<p>Can someone please help me out here ?</p>

<p>Thanks,
Alok.</p>

<p>//-- BoardActivity.java---</p>

<pre><code>public class BoardActivity extends Activity{

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Board boardView = new Board(this);
        //setContentView(boardView);   // This works fine but i want to use the board.xml
        setContentView(R.layout.board);
 }
}
</code></pre>

<p>//-- Board.java ---</p>

<pre><code> public class Board extends View {
    int _height;
    int _width;

    Bitmap _bitmap;
    Canvas _canvas;
    Paint _paint;

    public Board(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
        _paint = new Paint();
        _paint.setColor(Color.RED);
        _paint.setStyle(Paint.Style.STROKE);
        _paint.setStrokeWidth(10);
    }

    public Board(Context context, AttributeSet atts) {
        super(context, atts);

        // Is there any problem here ??

      } 

    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
        //super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        _height = View.MeasureSpec.getSize(heightMeasureSpec) ;
        _width = View.MeasureSpec.getSize(widthMeasureSpec) ;

        setMeasuredDimension(_width, _height);
        _bitmap = Bitmap.createBitmap(_width, _height, Bitmap.Config.ARGB_8888);
        _canvas = new Canvas(_bitmap);     
    }

    @Override
    protected void onDraw(Canvas canvas) {
        canvas.drawBitmap(_bitmap, 0, 0, _paint);

        //button = (Button)findViewById(R.id.matchImage);

    }
}
</code></pre>

<p>//---  board.xml ---------  </p>

<pre><code>&lt;LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  &lt;com.game.brainer.Board android:id="@+id/board"
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:layout_weight="1"
  /&gt;
   &lt;Button android:textSize="50sp" 
        android:layout_height="wrap_content" 
        android:text="Button" android:id="@+id/matchImage" 
        android:layout_width="wrap_content"/&gt;
&lt;/LinearLayout&gt;
</code></pre>
