8

My Android application allows user to open an image, create marks at the specific areas (a visual clue) for which they can separately add notes and exchange within their team.

E.g. To finalize on a construction plan the app allows to open the proposed plan as bitmap, where the management could suggest the modification by marking on the specific sections and add respective notes.

The requirement is, user should get a choice to pick a pattern to be drawn on his finger move.

What are the options Android provide to draw a pattern?

For your reference just look this following image. enter image description here

I want to draw one of the above pattern on finger touch.

Rohan Patel
  • 245
  • 2
  • 10

2 Answers2

1

With this code you can draw with finger in canvas.

Then add you must add shader to your Paint object to draw patterns like yours.

mPatternBitmap = BitmapFactory.decodeResource(getResources(), pPatternId);
mBitmapShader = new BitmapShader(mPatternBitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
mPaint.setShader(mBitmapShader);

Where pPatternId is your patterns image id from res.

Community
  • 1
  • 1
Ara Badalyan
  • 1,616
  • 1
  • 15
  • 20
0

You can use GestureDetector class which is more flexible to detect TouchEvents. You can refer to http://developer.android.com/training/gestures/detector.html for better explaination.

genius
  • 37
  • 6
  • I want to draw pattern on canvas not want to handle touch or any events. I know by using Path class we can draw line and set of rectangle on path. But i want some specific and perfect solution. – Rohan Patel Jul 25 '13 at 11:09
  • Do you mean patterns like Android Pattern lock ? – genius Jul 30 '13 at 10:56