rjava.lang.IllegalArgumentException on startActivity(intent,bundle animantion)

后端 未结 3 677
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-28 15:25

Hi I am using following code but sometimes app is crashing with error:

java.lang.IllegalArgumentException in startActivity(slideactivity, bndlanim

相关标签:
3条回答
  • 2020-12-28 16:03

    I found the problem, after digging really deep I saw that there is some problem with the SDK > 21 so lollipop up. In my case this happens when using transparent theme together with some enter and exit transitions.

    Two options:

    If I remove the ActivityOptions.makeCustomAnimation().toBundle(); and work good again.

    If I set my theme to my app normal theme works good too.

    I will have to investigate further but I guess there is some configuration on the theme that makes this crash.

    0 讨论(0)
  • 2020-12-28 16:15

    Try to use ActivityOptionsCompat instead of ActivityOptions if you are using ActivityCompat.startActivity(). As well use ActivityOptionsCompat.makeSceneTransitionAnimation() to make animation options.

    0 讨论(0)
  • 2020-12-28 16:16

    instead of

    startActivity(slideactivity, bndlanimation);
    

    use

    ActivityCompat.startActivity(this, slideactivity, bndlanimation)
    
    0 讨论(0)
提交回复
热议问题