to draw the circle on touch with the finger use this code this is with the
gesture listener
public class GesturesActivity extends Activity implements
OnGesturePerformedListener {
private GestureLibrary mLibrary;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mLibrary = GestureLibraries.fromRawResource(this, R.raw.spells);
if (!mLibrary.load()) {
finish();
}
GestureOverlayView gestures = (GestureOverlayView)
findViewById(R.id.gestures);
gestures.addOnGesturePerformedListener(this);
}
public void onGesturePerformed(GestureOverlayView overlay, Gesture
gesture) {
ArrayList<Prediction> predictions = mLibrary.recognize(gesture);
// We want at least one prediction
if (predictions.size() > 0) {
Prediction prediction = predictions.get(0);
// We want at least some confidence in the result
if (prediction.score > 1.0) {
// Show the spell
Toast.makeText(this, prediction.name,
Toast.LENGTH_SHORT).show();
}
}
}
}
On Thu, Jun 14, 2012 at 12:12 PM, Amey Bapat <[email protected]> wrote:
> 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
>
--
Thanks & Regards
K. Ajay Kumar
9700188853
--
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