After searching for a way to drag and drop bitmaps on a screen, i wrote a little example for a basic way of doing this.
I use a ColorBall class from a earlier example, and let the balls now being dragged.
The ColorBall.class holds the images and also the coordinates on the screen.

In theory this must work, because the radius is measured from the touch to the center of the ball.If the radius is less then the radius of the ball, the touch must be on the ball.I have painted (photoshopped) the balls on a square of 50px, with a space of 3 px at each side.

If i see this wrong i will hear that gladly

I have also added that the Ball ID will be 0 if no ball is clicked. Then nothing happens.

As you are using sqrt, which could be slow on actual hardware (as a lot of devices don't have devision in hardware) You could first try the rectangle collision detection and if you collide with such a rectangle try the round collision detection.

yxc3998 wrote:Thanks for sharing. One quick question: Is there any way to determine which image is on the top when 2 or more images are overlapped?

You can look at the drawing priority. Which ever got drawn first will be at the bottom!!

I think that wil indead lighten (up) the calculation. (only necesary if the touch is in the rectangle)I have comment out the earlier rectangle detection, but kept it in the class. So within the code it will be just copy and paste to get it working.

p.s. I have also another idea about the detection when bitmaps are 'touched' or colide, but must figure that out.Has something to do with Bitmap.getPixels() , what looks to do a detection on the pixels at the touch.

At the moment i'am in the middle of another android learning curve , but as soon as i finished that i will look into that.

I want to make a Jigsaw puzzle game on android using the above tutorial. Wonder if i can get further guidance on that? I like to know how can i determine the exact position as to where i am placing my graphic?

Actually i am new to android.I am using eclipse.I have installed android SDK. I have already executed other codes.they are perfect.I am also able to display readings of accelerometer on the emulator. But i am unable to move the image using simulator according to the mouse movement. Please help me.

This tutorial is great, thank you very much for posting it. I am brand new to Andriod development and learning by example is very helpful. Couple things I wanted to add and I am having trouble with:

How can I get the screen height? I wanted to set the balls just off the bottom of the screen on startup but I am not sure how to get the height of the screen. (i.e. point1.y = getHeight()-20; or something like that).

Also, what if I wanted to associate one ball as a way to change to a new screen, how can I call another View/Activity...I am not even sure if I am asking it right.

Hey, I am mucking about with this example (first android example I have looked at aside from the basic tutorials) and am trying to make the first ball move when you are not touching the screen. I am attempting this by simply adding the following code to the draw method:

The ball will only move when i am touching the screen for some reason (doesn't matter where I am touching). It seems the draw method is only called when there is interaction. Any idea what method i can put code in to have it called every cycle?