android programmatically add rectangle in
<p>Hello i added rectangle in my canvas now i want to add textview or some other view in that rectangle.Suggest me some tutorial also. Thanks in advance</p>

<pre><code>public class DrawView extends View {

    public DrawView(Context context) {
        super(context);
    }
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Rect rect = new Rect();
        rect.set(20 ,10 ,canvas.getWidth()/2, canvas.getHeight()/2);
        Paint paint = new Paint();
        paint.setColor(Color.GREEN);
        canvas.drawRect(rect, paint);
    }
}
</code></pre>
