Android getIntent on new activity is NULL when calling activity is destroyed

后端 未结 2 1730
盖世英雄少女心
盖世英雄少女心 2021-01-25 02:42

Do you guys have a workaround for the following problem?

In the onDestroy of a registration activity (when the user presses the back button) I call a new activity so the

相关标签:
2条回答
  • 2021-01-25 02:54

    Actually, I think I know what your problem is. I believe you are making this call:

     public AksProductionNumbers()
    

    in your activity constructor (as you state in your question) when you should be making it in the activity's onCreate method. getIntent will return null in the constructor.

    0 讨论(0)
  • 2021-01-25 02:56

    Try to put this

     Intent intent = getIntent(); // <-- returns null
        Bundle extras = intent.getExtras();
    

    on "onCreate()" method of new activity

    0 讨论(0)
提交回复
热议问题