getIntent() always returns null

后端 未结 2 2007
孤街浪徒
孤街浪徒 2021-01-23 09:26

This code starts the activity:

Intent intent = new Intent(context, GameActivity.class);
    intent.putExtra(\"load\", true);
    startActivity(intent);
         


        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-23 09:45

    private Intent intent = this.getIntent();
    

    Call getIntent() inside onCreate or in another callback of the life cycle.

提交回复
热议问题