You also need to update the variables upx and upy in your ACTION_MOVE case 
block:

case MotionEvent.ACTION_MOVE:
* **upx = event.getX();*
* upy = event.getY();*
 double temp = Math.pow((upx - downx), 2)
 + Math.pow((upy - downy), 2);
 float radius = (float) Math.sqrt(temp) / 2;
 canvas.drawCircle(downx, downy, radius, paint);
Log.d(TAG, "DRAG");
break;


On Friday, February 15, 2013 7:25:26 AM UTC-6, Numair Qadir wrote:
>
> Greetings,
> I'm trying to draw a circle using onTouch event. What it should do is get 
> the coordinates where screen is touched(ACTION_DOWN), and where touch is 
> lift up(ACTION_UP). For drawing circles we have 
> canvas.drawCircle(x,y,radius,paint); ..... Now radius should be equal to 
> the area where user has lift the touch up(ACTION_UP)... It is not drawing 
> like that.. Here is my code ..
>
> *case MotionEvent.ACTION_DOWN:*
> * downx = event.getX();*
> * downy = event.getY();*
> * Log.d(TAG, "DOWN");*
> * break;*
> * case MotionEvent.ACTION_UP:*
> * upx = event.getX();*
> * upy = event.getY();*
> * choosenImageView.invalidate();
> *
> * mode = NONE;*
> * Log.d(TAG, "mode=NONE");*
> * break;*
> *
> *
> * case MotionEvent.ACTION_MOVE:*
> * double temp = Math.pow((upx - downx), 2)*
> * + Math.pow((upy - downy), 2);*
> * float radius = (float) Math.sqrt(temp) / 2;*
> * canvas.drawCircle(downx, downy, radius, paint);*
> * Log.d(TAG, "DRAG");*
> * break;*
>
> Can any one help me??? Thanks in advance
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to