tags:

views:

160

answers:

0

Hello everyone,

I'm trying to create a simple path in the onDraw method of a SurfaceView object I've created and the layout editor keeps giving me "UnsupportedOperationException: null" whenever I add an arcTo command to the path.

How do I fix this?

Thanks,

Ryan

public class myView extends SurfaceView
{
    private Path myPath;

    public myView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onDraw(Canvas canvas)
    {
        super.onDraw(canvas);

        //set bounds
        final int top = 0 +this.getPaddingTop();
        final int bottom = this.getMeasuredHeight() - this.getPaddingBottom();
        final int left = 0 + this.getPaddingLeft();
        final int right = this.getMeasuredWidth() - this.getPaddingRight();
                int someHeight;
                int someWidth;
                innerLeft = new RectF(left + someWidth, bottom - otherHeight,
                       left + someHeight + 10 * 2, bottom);

        myPath.moveTo(left, bottom);
        myPath.lineTo(left, top + 10);
        myPath.arcTo(innerLeft, 180, 90);
        myPath.close();
    }
}