public class Home extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new MySurface(this));
}
}
heres da code fr MySurFace
public class MySurface extends ImageView {
float x, y;
Path path = new Path();
public MySurface(Context context) {
super(context);
this.setLayoutParams( new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
this.setOnTouchListener( new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
x = event.getX();
y = event.getY();
invalidate();
return false;
}
});
}
@Override
public boolean onTouchEvent(MotionEvent event) {
x = event.getX();
y = event.getY();
invalidate();
return super.onTouchEvent(event);
}
@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
Paint paint = new Paint();
paint.setColor(Color.RED);
//canvas.drawLine(x, y, x+20, y+20, paint);
path.moveTo(x, y);
//path.lineTo(x, y);
canvas.drawPath(path, paint);
}
}
just edit some methods fr drawing...
check out canvas methods for drwaing stuff..
all da best
On Thu, Jun 14, 2012 at 11:51 AM, Sadhna Upadhyay <[email protected]
> wrote:
>
> Hi everyone,
> I am making an app in which i have to to draw circle with the help of
> finger(on touch listener) in android ,
> can anyone help me
>
>
>
>
>
> Thanks and Regard
> sadhana
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
--
live and let LIVE!!!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en