Add Button to android.view.View
<p>I have the next issue:</p>

<p>I have an Activity, where I want to try to add Buttons, this is my onCreate method</p>

<pre><code>public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);

    DrawView drawView = new DrawView(this);
    setContentView(drawView);

    context = this;

    drawView.requestFocus();

}
</code></pre>

<p>This is the DrawView class</p>

<p>public class DrawView extends View implements OnTouchListener {</p>

<pre><code>public static final String TAG = "DrawView";

private List&lt;List&lt;Point&gt;&gt; listaPuntos = null;
private List&lt;Paint&gt; listaPaints = null;

private int paintActual = 0;

public DrawView(Context context) {
    super(context);
    setFocusable(true);
    setFocusableInTouchMode(true);

    listaPaints = new ArrayList&lt;Paint&gt;();
    listaPuntos = new ArrayList&lt;List&lt;Point&gt;&gt;();

    this.setOnTouchListener(this);
    this.setBackgroundColor(Color.WHITE);

    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(2);
    paint.setColor(Color.BLACK);
    listaPaints.add(paint);

}

@Override
public void onDraw(Canvas canvas) {

    for(int i=0; i&lt;listaPaints.size(); i++){
        Paint paint = listaPaints.get(i);
        Point punto = null;
        if(listaPuntos.size()!=0 &amp;&amp; listaPuntos.size()&gt;i){
            List&lt;Point&gt; puntos = listaPuntos.get(i);
            for (Point point : puntos) {

                if(punto == null){
                    punto = point;
                }
                canvas.drawLine(point.x, point.y, punto.x, punto.y, paint);
                punto = point;
            }
        }
    }
}

@Override
public boolean onTouch(View view, MotionEvent event) {

    if(event.getAction() != MotionEvent.ACTION_UP){
        Point point = new Point();
        point.x = event.getX();
        point.y = event.getY();
        point.paintPunto = paintActual;
        if(listaPuntos.size()&lt;=paintActual){
            listaPuntos.add(new ArrayList&lt;Point&gt;());
        }
        listaPuntos.get(paintActual).add(point);
        invalidate();
        return true;
    }else{
        paintActual++;
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(2);
        paint.setColor(Color.BLACK);
        listaPaints.add(paint);
    }
    return super.onTouchEvent(event);
}
</code></pre>

<p>Anybody knows how can I add Buttons to this Activity?? I would like to add a Button to be able to make an action and I completely can´t!!</p>

<p>Thanks a lot for your help.</p>
