-4

How to place a picture at some user input specific pixels on the screen in android. if a user taps at a certain point than an image should be pasted on that point. my main concern is not getting the pixels but putting an image within that set of pixels (I am having a set of pixels within that i have to re-scale the image and than place it at that position )

  • did you try to use the onTouchListener and get the coordinates from the MotionEvent object? view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { // motionEvent.getX() // motionEvent.getY() return false; } }); – Ran Hassid Nov 30 '15 at 10:34
  • as told by Ran hfirst find the touch coordinates on screen by using `view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View view, MotionEvent motionEvent) { // motionEvent.getX() // motionEvent.getY() return false; } });` – sud Nov 30 '15 at 10:36
  • my main concern is not getting the pixels but putting an image within that set of pixels (I am having a set of pixels within that i have to re-scale the image and than place it at that position ) – Divyesh Jindal Nov 30 '15 at 10:39
  • then follow the link given in my below answer – sud Nov 30 '15 at 10:43

1 Answers1

0

as told by Ran hassid first find the touch coordinates on screen by using

 view.setOnTouchListener(new View.OnTouchListener() {
 @Override public boolean onTouch(View view, MotionEvent motionEvent) { 
 motionEvent.getX()
 motionEvent.getY()
 return false; } });

and then follow this answer to show image at obtained cordinates by above code- link

Community
  • 1
  • 1
sud
  • 505
  • 1
  • 4
  • 12