I would like to create a notebook type application that will accept touch input and allow you to draw on the surface view. I'm unsure what I'm doing wrong since I have not programmed for the Android before.
Here is what I have:
findViewById(R.id.pageSurface).setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
SurfaceHolder holder = ((SurfaceView)findViewById(R.id.pageSurface)).getHolder();
Canvas canvas = holder.lockCanvas();
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(Color.BLACK);
paint.setDither(true);
paint.setColor(0xFFFFFF00);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setStrokeCap(Paint.Cap.ROUND);
paint.setStrokeWidth(3);
canvas.drawPoint(event.getX(), event.getY(), paint);
holder.unlockCanvasAndPost(canvas);
return true;
}
});
}