How can I check the Image is Touched using OnTouch()?

MoveX - It is the starting x co-ordinate of your view. MoveY - It is the starting y co-ordinate of your view. ImgHeiht - It is the Height of the Image; imgWidth - It is the Width of the Image; event.getX()- It is the actual position of your X co-ordinate.Event.getY()- It is the actual position of your Y co-ordinate.

If(MoveX.

These are some of the methods you can call from an image view assuming you have this image in it. Try experimenting and you me get what you need. ImageView iv; iv.

SetOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { event.getX(); event. GetX(pointerIndex) event.getXPrecision() return true; } }).

I am doing this but I want to get the x,y co-ordinate of the Image then touched. – Lalit Poptani Aug 4 '11 at 10:10.

Try this.. ImageView. SetOnTouchListener(new View.OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction()==MotionEvent. ACTION_DOWN) { float x = event.getX(); float y = event.getY(); } return true; } }.

I had done this but I want to get the x,y co-ordinates when the Image is Touched. – Lalit Poptani Aug 4 '11 at 9:38 I get it, but as for me I don't know if there is any direct methods. But you sure can calculate the values relative to the images (top,left)(x,y) to the screens origin.

Sure its worth if we have a direct method. – Sam Quest Aug 4 '11 at 9:41 using this you will get X-Y position of ImageView on Touch.. – CapDroid Aug 4 '11 at 9:44 @CapDroid requirement is about to get the position of some view. This will give only xy co-ordinate of the screen.

– Siten Aug 4 '11 at 10:46 it will given position of that view which had you applied onTouch Method – CapDroid Aug 4 '11 at 10:48.

You cannot direct get the image co-ordinates,when you draw the image ,you can get the image area in the screen,then you can use @CapDroid method to get the image co-ordinates.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions