Control the back “button” in android

前端 未结 2 658
没有蜡笔的小新
没有蜡笔的小新 2021-01-14 09:20

I want to get the Text data value from Sub-Activity back. And everything is ok. But when the Sub-activity was opened, then I just click back \"button\" on the phone, it thro

2条回答
  •  迷失自我
    2021-01-14 10:21

    Try putting in some logging into the onActivityResult(...) method of your main activity. The "back" button from the subactivity may be giving you a result code of RESULT_CANCELED, and the intent can be null in that case. So you'll get an NPE at

    Bundle bundle = intent.getExtras();

提交回复
热议问题