Gulu Guliyev 0 Newbie Poster

Good Afternoon Everyone. I have written this code in Android studio and the purpose of it is just to move the button to the bottom-right corner of screen with small delay. However, for some reasons, The button does not move. Any help is highly appreciated.

package com.xdroidcompany.transition;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.transition.TransitionManager;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;

public class MainActivity extends AppCompatActivity {

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

        GameLayout =(ViewGroup)findViewById(R.id.buckysLayout);
        GameLayout.setOnTouchListener(
            new RelativeLayout.OnTouchListener() {
                public boolean onTouch(View v, MotionEvent event) {
                    moveButton();
                    return true;
                }
            }
        );
    }

    public void moveButton()
    {
        View button =(Button)findViewById(R.id.buckysButton);
        ViewGroup layout =(ViewGroup)findViewById(R.id.buckysLayout);
        TransitionManager.beginDelayedTransition(layout);

        RelativeLayout.LayoutParams positionRules = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT
        );

        positionRules.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,RelativeLayout.TRUE);
        positionRules.addRule(RelativeLayout.ALIGN_PARENT_RIGHT,RelativeLayout.TRUE);
        button.setLayoutParams(positionRules);

        ViewGroup.LayoutParams sizeRules = button.getLayoutParams();
        sizeRules.width=300;
        sizeRules.height=400;
        button.setLayoutParams(sizeRules);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}