androidkotlindeprecated

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)


Solution

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