android - how to move image when clicked? - android

I try to make an application which place a certain png file in the screen with coordinates, and when the user clicks it, the image will move to another location in the screen.
can you guys give the sample..?? I'm kinda confused on how to draw the image (using bitmap or button??) and how to move it ??
THX for the answer...

refer this
Image in Canvas with touch events

Related

drag and drop imageview in android and detection position

I am making an application that drag and drop images. I need to make the user of the app can move an image from one point to another of the screen, for example He will touch the image and drag it to a point on the screen where there is another image, and when both images are superimposed, a message on screen, how could I do it?
Thanks very much
I think this can help you with the drag and drop
https://www.youtube.com/watch?v=H3qr1yK6u3M
To know image position you need to work with the ontouchevent:
How to get the Touch position in android?

Android How to detect area touch in image in one image

this example image for split area.
http://postimg.org/image/j35tjjk57/
i want to detect when user touch number in image.
how to programming.
thank you.
You need to define a Path for a region and then check whether your touch point is inside a path, how it is described there.

Moving image in circle with touch move

I want to move an image within a circle with my touch on move. I've been confused how to determine the coordinates circle boundaries when the finger moved.
For example I want to move this image like lock screen on android tabs.
http://cdn.alltouchtablet.com/wp-content/uploads/2012/03/samsung-galaxy-tab-7-plus-lock-screen.jpg
EDIT :
Now After learn the answer below, I managed to draw an circle image and moving this image around the screen.
And now, I want to restrict the image movement so that it only can moved in a circle, just like in the image above. Any ideas?
I hope you can help me. Thank you!
so I've actually not done anything like this but i know this tutorial : and the guy does something similar to what you want,
this video is one right in the middle of an entire playlist of tutorial videos if you dont get what he's doing check the previous few... as for moving the image in a circle i'm sure there'll be some way to set boundries :)
http://www.youtube.com/watch?v=9d4Wua-cxZs&list=PLB03EA9545DD188C3&index=32&feature=plpp_video
hope it was helpful!

Is it possible to get the points of bitmap as path?

suppose my bitmap is like
This image is actually in square transparent. I want to get the only viewable points as array so I can bound it and handle touch event on canvas. Right now it is square so when I touch at the corner of the image it still detect touch event on image. i don't want to do like this. Only if user clicked on viewable part then only action would be taken otherwise not.
For temporary I have used radius of image from center point it works fine but accurate, also if this image triangle part length is long then if it remain in square format user fill/get event on image outside.
I have used canvas to draw bitmap. Is there any other way or easy way to do this thing and handle event.
I have seen many games in that they used like custom shapes and touch event fire only on display part of object, how could i achieve this things.
Take a look at coordinates:
Android Canvas Coordinate System
and
http://code.google.com/p/apps-for-android/source/browse/trunk/SpriteMethodTest/src/com/android/spritemethodtest/CanvasSprite.java?r=150
Which goes into sprite:
http://p-xr.com/android-tutorial-how-to-paint-animate-loop-and-remove-a-sprite/
This may help too:
http://www.droidnova.com/playing-with-graphics-in-android-part-vi,209.html
Some of that should be helpful.

how can i use ontouch function to move an image with cursor in android?

I am making an small application in android in which i used an image and i used two buttons here when i click the first button the image will zoom and when i click second button the image will zoom out. But now i want when the image will zoom i can able to move the image with mouse cursor in emulator or(by touch in devise) so that i can able to view the whole image after zooming.can you suggest me any idea .**
Thanks in advance!
Try just moving the initial drawing coordinates. For instance when the image is first shown, I would imagine that it is at 0,0. when you want to move the image just directly modify the start coords accordingly.

Categories

Resources