Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

overridePendingTransition is deprecated, how do i do?

There is an animation playing when i finish a child activity or when the main one resume, im not sure which event is triggering it but i would like to replace it. Im targeting api level 34 with a min level of 28.

Im currently using

val intent = Intent(this, SettingsActivity::class.java)
val anim = ActivityOptions.makeCustomAnimation(
     applicationContext,
     R.anim.right_slide_in, R.anim.none
).toBundle()
startActivity(intent, anim)

I want to play an animation starting an activity but this did not help when I try to resume a parent activity or finish a child activity (again idk in which of these two cases the animation happens)

ChatGPT gave me some "solutions" with startAnimation on the rootView but nothing happens (and it also dont understand the word deprecated so its impossible to correct itself)

like image 361
Jonas Charrier Avatar asked Dec 28 '25 23:12

Jonas Charrier


1 Answers

Starting API 34 , you have to use overrideActivityTransition , here is the official documentation to how to use it .

like image 186
ismail alaoui Avatar answered Jan 02 '26 05:01

ismail alaoui



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!