How to add a class extending view to current class view
<p>I have a class Drawview:</p>

<pre><code>public class DrawView extends View {
   private ColorBall[] colorballs = new ColorBall[3]; // array that holds the balls
   private int balID = 0; // variable to know what ball is being dragged

    public DrawView(Context context) {
        super(context);
        setFocusable(true); //necessary for getting the touch events

        // setting the start point for the balls
        Point point1 = new Point();
        point1.x = 50;
        point1.y = 20;
        Point point2 = new Point();
        point2.x = 100;
        point2.y = 20;
        Point point3 = new Point();
        point3.x = 150;
        point3.y = 20;


        // declare each ball with the ColorBall class
        colorballs[0] = new ColorBall(context,R.drawable.bol_groen, point1);
        colorballs[1] = new ColorBall(context,R.drawable.bol_rood, point2);
        colorballs[2] = new ColorBall(context,R.drawable.bol_blauw, point3);


    }
    }
</code></pre>

<p>And my current class is:</p>

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

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.e);
AbsoluteLayout l= (AbsoluteLayout)findViewById(R.id.ll);
DrawView d=new DrawView(this);
l.addView(d);
}
}
</code></pre>

<p>I am trying to add that DrawView class but its not getting added as a child view of Absolutelayout of my current class view.its executing without any error but i am not able to see Drawview class objects.
And when i am doing this:</p>

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

        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.e);
    AbsoluteLayout l= (AbsoluteLayout)findViewById(R.id.ll);
    DrawView d=new DrawView(this);
    l.addView(d);
    }
    }
</code></pre>

<p>I am getting NullPointerException it means its not renderring the Drawview View.So bottom line is how to add a class extending a View to current view.
Please help me..thanx</p>
