Code example for Vector

Methods: add, lastElement

0
     * Adds control points whose coordinates range from 0 to 1 to construct the doodle path. 
     * 
     * @return true if the constructed path is in (0, 0, 1, 1) bounds; otherwise, false. 
     */ 
    public boolean addControlPoint(PointF point) {
        PointF last = points.lastElement();
        normalizedPath.quadTo(last.x, last.y, (last.x + point.x) / 2, (last.y + point.y) / 2);
        points.add(point);
 
        RectF r = new RectF();
        normalizedPath.computeBounds(r, false);
        return r.intersects(0, 0, 1, 1);
    } 
 
    public int getColor() { 
        return color;
    } 
 
    public boolean isEmpty() { 
        return normalizedPath.isEmpty();
    }