This code should be drawing things, but it doesn’t draw anything when I move my finger. Please help me debug it.
@Override
protected void onDraw(Canvas canvas) {
canvas.drawPath(path, paint);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
float eventX = event.getX();
float eventY = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
path.moveTo(eventX, eventY);
return true;
case MotionEvent.ACTION_MOVE:
path.lineTo(eventX, eventY);
break;
case MotionEvent.ACTION_UP:
// nothing to do
break;
default:
return false;
}
// Schedules a repaint.
invalidate();
return true;
}
}
Try this
For more information take a look
http://code.google.com/p/strokesformartians/source/browse/trunk/src/se/combitech/strokesformartians/drawing/FingerPaint.java?r=120
This may help you.