I want to slide from left to right (opposite right to left in this code below). My current task is running correctly on button click.
Here is the source:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    
    Button btnopen = (Button)findViewById(R.id.btnWindowAnimation);
     
    btnopen.setOnClickListener(new View.OnClickListener() {
     
    @Override
    public void onClick(View v) {
     
    Intent i = new Intent(MainActivity.this, SecondActivity.class);
     
    Bundle bundle =ActivityOptions.makeCustomAnimation(getApplicationContext(), `              `R.anim.animation,R.anim.animation2).toBundle();
    startActivity(i, bundle);
     
    }
    });
    
}
Here Animation 1:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="100%p"
android:toXDelta="0"
android:duration="500"/>
Here Animation 2:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="0"
android:toXDelta="-50%p"
android:duration="500"/>
 
     
     
    