3

Can you help me with the logic for my program

My program should do the following:

When i draw a circle with mouse it should recognize it as circle. similarly for square,oval etc. I want step by step procedure can anyone help?

yes I tried that code. but am not able to customise it.

I don't know where to change the code for adding circle, square

1 Answer 1

5

If that's the only thing that is necessary I would use android gestures. You can find examples and more info over here. You just have to create an oval, circle, triangle gesture and Android will recognize it for you. It's really easy, productive and does exactly what you want. In the link is a step-by-step procedure of how to do this.

You can do it also by saving all the x/y coordinates of the drawn shape and then compare it using circle/oval equations.

I would go for the first solution if you don't have any additional requirements.

edit/

You can copy the gestures from the emulator to your computer with

./adb pull /sdcard/gestures ~/test 

You have to put them in de res/raw folder to use them in your application.

edit/

adb commands: click here

Sign up to request clarification or add additional context in comments.

5 Comments

yes I tried that code. but am not able to customise it. I don't know where to change the code for adding circle, square
You have to use the gesture builder which is installed on the Android emulator to create new gestures.
I added in gesture builder. it is saved. can you tel me how to read the saved file from sdcard and package it in the application. Plz post me a reply..
thanks for your reply.. I ran ./adb pull /sdcard/gestures ~/test in cmd but it says it is not recognized as a command. can you help me out.am new to android
You can find a guide to use adb commands in the url in my edited post.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.