Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why am I getting wrong requestCode?

Tags:

android

I have an Activity in which I use startActivityForResult(intent,634). If I using it from activity, requestCode in onActivityResult() is Ok. But if I use startActivityForResult(intent,634) from my DialogFragment in this Activity, I'm getting another requestCode, something like 66170. So why its happens?

like image 424
jumper0k Avatar asked Dec 01 '12 13:12

jumper0k


1 Answers

It happens because if you use startActivityForResult from the dialog, in onActivityResult you get the requestCode of the dialog. Not from your another Activity. And if you want to get right requestCode, you should use getActivity().startActivityForResult(intent,requestCode) in DialogFragment.

like image 154
jumper0k Avatar answered Sep 22 '22 15:09

jumper0k