Android View Canvas onTouchEvent
<p>I'm trying to do a stupid application where a "<code>HelloWorld!!</code>" String drawn using a <code>Canvas</code> moves. The position <code>(x_new, y_new)</code> of the string is simply its old position <code>(x_old, y_old)</code> plus the <code>(x, y)</code> returned by an <code>ACTION_UP</code> event. The problem is that the event <code>ACTION_UP</code> it's not recognized. The <code>Log.d()</code> function prints always something like <code>motionEvent(28254): MotionEvent{4050df70 action=4 x=354.0 y=415.0 pressure=0.20000002 size=0.26666668}</code> where <code>action=4</code> never change. Do you have got any suggestions? Thanks!!</p>

<pre><code>class myView extends View {

private Canvas canvas;
    private int x;
private int y;

public HUDView(Context context) {
   super(context);
   this.x=5;
   this.y=5;    

}


protected void onDraw(Canvas canvas) {
    this.canvas=canvas;
    this.canvas.drawText("HelloWorld!!", x, y, mLoadPaint);
}

@Override
public boolean onTouchEvent( MotionEvent event) {
    super.onTouchEvent(event);
    Log.d("motionEvent", event.toString());
    if (event.getAction()==MotionEvent.ACTION_UP){
        Log.d("motionEvent", "action_up");
            this.x+=(int)event.getX();
            this.y+=(int)event.getY();
        return true;
    }
    this.postInvalidate();
    return true;
}


}
</code></pre>
