Help with OnTouch
<p>I am trying to create a few circles when the user touches, and if they touch again depending where they touch another one would show... but when I use the ontouch event.. it crashes... I am new by the way, how can I fix it?</p>

<pre><code>public class GameView extends View{

    private final float x;
    private final float y;
    private final int r;
    private final Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);

    public GameView(Context context, float x, float y, int r) {
        super(context);
        mPaint.setColor(0xFFFF0000);
        this.x = x;
        this.y = y;
        this.r = r;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawCircle(x, y, r, mPaint);
    } 
</code></pre>

<p>}</p>

<pre><code>public class GameActivity extends Activity {    
/** Called when the activity is first created. */ 
GameView gm;
@Override  
public void onCreate(Bundle savedInstanceState) {  
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    FrameLayout main = (FrameLayout) findViewById(R.id.my_view); 

    main.setOnTouchListener(new View.OnTouchListener() {
        public boolean onTouch(final View v, MotionEvent e) {
             final float x = e.getX();
             final float y = e.getY();
              final Handler handler = new Handler() 
              {                  
                public void handleMessage(Message msg) {

                         gm.postInvalidate();    

                  }                 
                };          
                Thread graphicThread = new Thread()       
                {                        
                    public void run() {                              

                        try {

                            //Do the drop
                               FrameLayout flView = (FrameLayout) v;
                              flView.addView(new GameView(getParent(), x,y,25));


                                 Thread.sleep(1000);

                                 handler.sendMessage(handler.obtainMessage());
                            }
                         catch (InterruptedException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }

                    }                     
                    };                
                     boolean isRunning=true;
                    graphicThread.start();   
                    return true;

                    }           


    }); 


  }
}
</code></pre>
