Adding touchListener to path object

Viewed 453

I have an canvas over which i set a path

Path path = new Path();
path.moveTo(1, 1);
path.lineTo(90, 1);
path.lineTo(90, 60);
path.lineTo(1, 60);

canvas.drawPath(path,p);

Now i want to implment a touch listener to this path object.

I have implemented zooming option on a custom ImageView and drawing this lines over a canvas in the onDraw method of this custom ImageView. So i cant do it by checking the coordinates where user have touched.

I know that the the path object is not a child of View Class and hence i cannot implement a touchListner in it. But the thing the that i exactly need is something like

path.setOnTouchListener(myTouchListner);

Does anyone have any idea about how to implement it? Any help is appreciated.

2 Answers
Related