I want to remove the old activity from stack after clicking on a button that triggers an intent to a new activity. The problem is: The transition is not smooth like a normal transition. For like a half second the screen is completely white. How to make this smooth?
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}
});
Use: Activity.overridePendingTransition().
Define simple transition animations with XML file.
Remmember this 4 atributes:
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="2000"
This atributtes make "smooth" transition
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With