How to draw on an ImageView
<p>Why will this code not draw a circle where the user touches in an imageview and output the coordinates to a textview?</p>

<pre><code>package com.smallbore.smallbore;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.ImageView;
import android.widget.TextView;

public class targetenter extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.targetenter);
    }

   public class ImageView1 extends ImageView {
        public int x;
        public int y;
        public ImageView1(Context context) {
            super(context);
            // TODO Auto-generated constructor stub
        }
        public boolean dispatchtouchevent(MotionEvent event){
            x = (int) event.getX();
            y = (int) event.getY();
            TextView t1 = (TextView)findViewById(R.id.textView2);
            t1.setText("x="+x);
            TextView t2 = (TextView)findViewById(R.id.textView3);
            t2.setText("y="+y);
            invalidate();
            return true;
        }
        @Override
        public void onDraw(Canvas canvas){
            super.onDraw(canvas);
            canvas.drawCircle(x,y,10, null );
    }
}
}
</code></pre>

<p>and the xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:id="@+id/linearLayout1" android:layout_height="fill_parent" android:layout_width="fill_parent"&gt;
    &lt;TextView android:layout_height="wrap_content" android:text="@string/cposition" android:id="@+id/textView1" android:layout_width="wrap_content"&gt;&lt;/TextView&gt;
    &lt;com.smallbore.smallbore.targetenter.Imageview1 android:id="@+id/imageView1" android:layout_width="300dip" android:layout_height="300dip" android:background="@drawable/target" android:layout_gravity="center_horizontal"&gt;&lt;/com.smallbore.smallbore.targetenter.Imageview1&gt;
    &lt;TextView android:text="TextView" android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;&lt;/TextView&gt;
    &lt;TextView android:text="TextView" android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;&lt;/TextView&gt;
&lt;/LinearLayout&gt;
</code></pre>
