Unable to move image in app
<p>I am developing hunting game, for that i have to move the gun in horizontal direction
I can display the gun but, am unable to move the gun. For motion I have taken <code>ontouchlistener</code> but am not able to move :</p>

<pre><code>public class Touchmoveimage extends Activity {

    int x,y,x1,y1;

    RelativeLayout rl;

public void onCreate(Bundle savedInstanceState) 

{

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    rl=(RelativeLayout)findViewById(R.id.bb);

    x = getWindowManager().getDefaultDisplay().getWidth();

    y = getWindowManager().getDefaultDisplay().getHeight();

    final ImageView balls = (ImageView)findViewById(R.id.ball);

    balls.setOnTouchListener(new View.OnTouchListener() 

    {


   public boolean onTouch(View v, MotionEvent event) 

                  {

                        if(event.getAction()==MotionEvent.ACTION_DOWN)

                        {
                            x1=(int) event.getX();

                            y1=(int) event.getY();

                            RelativeLayout.LayoutParams param=new        
                                RelativeLayout.LayoutParams(x1,y1);

                                 rl.addView(balls, param);
                        }
                        return false;

                    }
    }
    );
}
}
</code></pre>
