Show DialogFragment from onActivityResult

前端 未结 17 1270
傲寒
傲寒 2020-12-04 06:47

I have the following code in my onActivityResult for a fragment of mine:

onActivityResult(int requestCode, int resultCode, Intent data){
   //other code
   P         


        
17条回答
  •  醉话见心
    2020-12-04 07:09

    I believe it is an Android bug. Basically Android calls onActivityResult at a wrong point in the activity/fragment lifecycle (before onStart()).

    The bug is reported at https://issuetracker.google.com/issues/36929762

    I solved it by basically storing the Intent as a parameter I later processed in onResume().

    [EDIT] There are nowadays better solutions for this issue that were not available back in 2012. See the other answers.

提交回复
热议问题