09-13-2010 07:05 AM
Thanks for the suggestion .
After overiding paint method I was able to have a pointer as bitmap drawn and passed X and Y positions which made the pointer move on trackball movement.
Here is the code:
Bitmap pointer = Bitmap.getBitmapResource("Mouse_pointer_small.png"
protected boolean navigationMovement(int dx, int dy, int status, int time)
if (dy > 0)
y += 15;
if (dy < 0)
y -= 15;
if (dx > 0)
x += 15;
if (dx < 0)
x -= 15;
return super.navigationMovement(dx, dy, status, time);
protected void paint(Graphics graphics)
graphics.drawBitmap(x, y, pointer.getWidth(), pointer.getHeight(), pointer, 0, 0);
As you see I am moving 15 pixels per movement but it is not so smooth and even i wan't to control the acceleration of the mouse mointer .
09-13-2010 07:13 AM
I would recommend that you use the dx and dy as a factor in your movement to. I think you will find that they actually vary depending on how quickly the user has moved their finger.
09-13-2010 07:25 AM
I reduced it to 5 pixels and it certainly removed the jerks from the movement but If user is playing a Game and has to click some elements within some time period then how the user will be able to move the pointer quickly to that co-ordinate.
09-14-2010 06:44 AM
You can create a background thread to process the movement. Every movement let the thread process 15 pixels but 5 pixels at a time and sleep for some time before processing the next 5 pixels.
This will require the screen to redraw 3 times every movement though. But it's something you can try.