I used four buttons (Up,down,Left,Right) and also i have image. I have to move the image accordingly when i press UP button i should move image in upward direction and when
I think the problem is (int)getRawx(); and (int)getRawy();, you are calling this methods on Activity and I'm not so sure you really need those values.
(int)getRawx();
(int)getRawy();
you could try:
mParams.leftMargin += 50;
or
int x = mParams.leftMargin; mParams.leftMargin = x + 50