NullPointerException with custom View
<p>first sorry for my english, i´m spanish, now, i´m having problems making a custom class that extends View. Theese are my classes and my xml file:</p>

<pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" &gt;

    &lt;LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="@android:color/white" &gt;

        &lt;ImageButton
            android:id="@+id/paleta"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/paleta" /&gt;
    &lt;/LinearLayout&gt;

    &lt;LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/pizarra"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" &gt;


    &lt;/LinearLayout&gt;

&lt;/LinearLayout&gt;
</code></pre>

<hr>

<pre><code>public class Pintar extends View {
    private Bitmap mBitmap = null;
    private Canvas mCanvas = null;
    private Path mPath = null;
    private float mX, mY;
    private static final float TOLERANCE = 4;
    private LinearLayout pizarra;

    public Pintar(Context context) {
        super(context);
        // obtener pantalla
        pizarra= (LinearLayout) findViewById (R.id.pizarra);
        mBitmap = Bitmap.createBitmap(pizarra.getWidth(),
                pizarra.getHeight(), Bitmap.Config.ARGB_8888);
        mCanvas = new Canvas(mBitmap);
        mPath = new Path();
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        float x = event.getX();
        float y = event.getY();
        switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            touchStart(x, y);
            invalidate();
            break;
        case MotionEvent.ACTION_MOVE:
            touchMove(x, y);
            invalidate();
            break;
        case MotionEvent.ACTION_UP:
            touchUp();
            invalidate();
            break;
        }
        return true;
    }

    private void touchStart(float x, float y) {
        mPath.reset();
        mPath.moveTo(x, y);
        mX = x;
        mY = y;
    }

    private void touchMove(float x, float y) {
        if (Math.abs(x - mX) &gt;= TOLERANCE || Math.abs(y - mY) &gt;= TOLERANCE) {
            mPath.quadTo(mX, mY, (x + mX) / 2, (y + mY) / 2);
            mX = x;
            mY = y;
        }
    }

    private void touchUp() {
        mPath.lineTo(mX, mY);
        mCanvas.drawPath(mPath, Blackboard.mPaint);
        mPath.reset();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        // fondo
        canvas.drawColor(0XFFBBBBBB);
        // lo ya pintado
        canvas.drawBitmap(mBitmap, 0, 0, null);
        // el trazo actual
        canvas.drawPath(mPath, Blackboard.mPaint);
    }



public class Blackboard extends Activity {

    public static Paint mPaint = null;
    protected Pintar board;
    private LinearLayout pizarra;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        board = new Pintar(this);
        pizarra= (LinearLayout) findViewById (R.id.pizarra);
        pizarra.addView(board);
        setContentView(R.layout.main);
        // preparamos el pincel
        mPaint = new Paint();
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeJoin(Paint.Join.ROUND);
        mPaint.setStrokeCap(Paint.Cap.ROUND);
        mPaint.setAntiAlias(true);
        mPaint.setDither(true);
        mPaint.setColor(0XFF00E1FF);
        mPaint.setStrokeWidth(10);
    }
</code></pre>

<p>I want to show in the top LinearLayout an ImageButton and in the bottom LinearLayout i want to paint with my custom class but i have this error:</p>

<pre><code>06-25 18:43:07.578: E/AndroidRuntime(19822): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.acme.blackboard/com.acme.blackboard.Blackboard}: java.lang.NullPointerException
</code></pre>

<p>thanks for the answers</p>
