search

Home  >  Q&A  >  body text

android - 别人的activity按返回键退出后 再次打开后 就不显示开场动画 但是我的按退出后直接destroy,依然显示开场动画

别人的activity按返回键退出后 再次打开后 就不显示开场动画 但是我的按退出后直接destroy,依然显示开场动画

PHP中文网PHP中文网2772 days ago542

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 17:48:26

    Yours is a normal phenomenon of starting a new Activity every time, because it is destroyed every time you go back. As for you saying that there is no startup animation for other people’s second login (is it the startup animation of the Activity or is it customized? An animation?), the current guess is that the startup mode uses singleInstanse, and then it is not destroyed when the return button is clicked, but moveTaskToBack, and then the existing Activity is opened when it is started again. At this time, the life cycle only goes onResume, as described It’s too vague, I’ll give you a rough guess

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 17:48:26

    Check whether the return key event calls finish() or System.exit(0);
    If finish() is called, then when you click the app's desktop icon again, it will restart. process, the opening animation will be displayed again

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 17:48:26

    Call moveTaskToBack(true) when onBackPressed, which is equivalent to pressing the Home button without closing the Activity

    reply
    0
  • Cancelreply