Start Another Activity from onCreate() in MainActvity?

后端 未结 5 528
终归单人心
终归单人心 2021-01-18 03:24

The problem I am having is that the onCreate() method within my MainActivity cannot seem to start another activity.

I have code working so that when I click a button

5条回答
  •  爱一瞬间的悲伤
    2021-01-18 03:39

    I just realized what the problem is.

    The issue is that the AboutActivity is causing the intent to fire repeatedly. The first line in the AboutActivity's onCreate() is super.onCreate(savedInstanceState). This means that application control will go back to the MainActivity's onCreate() where the intent will then be fired again. Therefore, I seem to have caused an infinite loop of intent calling.

    I will post the solution if I find it.

提交回复
热议问题