I have class that extends View.
private class Draw2D extends View{
public Draw2D(Context context) {
super(context);
}
You need to track the coordinates of your drawable so you can compare with the touch x, y coordinates.
So basically:
// can modify to adjust speed at which drawable moves
int movementSpeed = 2;
if (drawableX < x)
drawableX += movementSpeed;
else if (drawableX > x)
drawableX -= movementSpeed;
if (drawableY < y)
drawableY += movementSpeed;
else if (drawableY > y)
drawableY -= movementSpeed;
Then need to redraw your drawable with the updated drawableX, drawableY coordinates.