for the code I have a little android guy walk accross the screen, however this is using a bitmap how could I change it so it is an image button so I can click him and make it do somthing he is the code I have used for the bit map moving.
canvas.drawBitmap(AndroidDude, AndroidDudeChangingX, (canvas.getHeight()/2 - (AndroidDude.getHeight()/2)), null);
if (AndroidDudeChangingX < canvas.getWidth() - 280)
{
AndroidDudeChangingX += 10;
}
else
{
AndroidDudeChangingX = 0;
}
You don't need an imagebutton for that. Just get the Rect where your bitmap is located in the screen and implement the ontouch event of your activity. If the touch event happened inside of the Rect of your bitmap, you should handle the event properly.