简体   繁体   中英

activity life cycle with animation

I have four buttons calling different activities via intent. the manner in which i am calling is something like below

Intent intent = new Intent(MenuActivity.this,Test3.class);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
finish();
startActivity(intent);

but i am unable to get it as expected..there is not animation i can see. Am I calling animation start activity and finish in right way??

or rather I should use something like flag clear top?

You have to call overridePendingTransition(R.anim.fade_in, R.anim.fade_out) directly after startActivity(intent) .

This should work for you:

Intent intent = new Intent(MenuActivity.this,Test3.class);
startActivity(intent);
overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
finish();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM