MainActivity.java
public class MainActivity extends AppCompatActivity { Button buttonShow; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); buttonShow= (Button) findViewById(R.id.buttonShow); buttonShow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(MainActivity.this,AnimatedActivity.class); startActivity(intent); overridePendingTransition(R.anim.activity_back_in,R.anim.activity_back_out); } }); } }
AnimatedActivity.java
public class AnimatedActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_animated); } @Override public void onBackPressed() { super.onBackPressed(); overridePendingTransition(R.anim.activity_back_in,R.anim.activity_back_out); } }
References
https://github.com/mhdr/AndroidSamples/tree/master/059
https://developer.android.com/training/animation/cardflip.html