Android Déplacer ImageView

J'ai cherché sur le web pour une solution simple pour se déplacer librement d'un ImageView. J'ai enfin trouvé un peu de code qui produit un résultat parfait:

public class MainActivity extends Activity implements View.OnTouchListener {

    private int _xDelta;
    private int _yDelta;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ImageView j = (ImageView)findViewById(R.id.j);

        j.setOnTouchListener(this);

    }

    public boolean onTouch(View view, MotionEvent event) {
        final int X = (int) event.getRawX();
        final int Y = (int) event.getRawY();
        ImageView j = (ImageView)findViewById(R.id.j);
        switch (event.getAction() & MotionEvent.ACTION_MASK) {
            case MotionEvent.ACTION_DOWN:
                RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams) view.getLayoutParams();
                _xDelta = (int) (X - j.getTranslationX());
                _yDelta = (int) (Y - j.getTranslationY());
                break;
            case MotionEvent.ACTION_UP:
                break;
            case MotionEvent.ACTION_POINTER_DOWN:
                break;
            case MotionEvent.ACTION_POINTER_UP:
                break;
            case MotionEvent.ACTION_MOVE:
                RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) view.getLayoutParams();

                j.setTranslationX(X - _xDelta);
                j.setTranslationY(Y - _yDelta);
                break;
        }

        return true;
    }}

Depuis je ne sais pas vraiment comment mon code fonctionne, je voulais voir si il y avait de meilleures solutions.

OriginalL'auteur ueen | 2013-12-20