Flip screens from one activity to another in android

In fact, I want to rotate or flip the screen by pressing a button from one activity to another: for example, this

early.

+4
source share
4 answers

You can override the transition between actions that perform the following actions:

Button btn = (Button)findViewById(R.id.myBtn); btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { startActivity(new Intent(ActualActivity.this, TargetActivity.class)); overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up); } }); 

Where slide_in_up and slide_out_up are your custom animations saved in res / anim. Here are some sample code:

slide_in_up:

 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromYDelta="-100%p" android:toYDelta="0" android:duration="300"/> </set> 

slide_out_up:

 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate android:fromYDelta="0" android:toYDelta="100%p" android:duration="300"/> </set> 

This example will move your activity from top to bottom. You can change the animation files to get different animations.

+2
source

You can find the answer here: Activity transition in Android

Two options:

Like this:

 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().setWindowAnimations(ANIMATION); ... } 
+1
source

The link provided by @abhy is the one we all followed once :)

But heโ€™s not going to work to move from one activity to another, what I did to achieve this behavior is to get a bitmap of the activity im and the one they are aiming for, to make this transition and when to finish it the initial activity that overrides the waiting transition without effect.

I donโ€™t think this is a great approach and I will be happy to know if anyone has a better idea :)

Hi,

+1
source

All Articles