Wrong requestCode in onActivityResult

前端 未结 6 1112
离开以前
离开以前 2020-11-28 01:14

I\'m starting a new Activity from my Fragment with

startActivityForResult(intent, 1);

and want to handle the result in the Fragment\'s pare

6条回答
  •  無奈伤痛
    2020-11-28 01:35

    If you are providing constant make it public and then use in startActivityResult

    example:

    public static final int REQUEST_CODE =1;
    getActivity().startActivityForresult(intent, REQUEST_CODE);
    

提交回复
热议问题