The activity hosting this fragment has its onActivityResult
called when the camera activity returns.
My fragment starts an activity for a result with th
Most of these answers keep saying that you have to call super.onActivityResult(...)
in your host Activity
for your Fragment
. But that did not seem to be working for me.
So, in your host Activity
you should call your Fragments
onActivityResult(...)
instead. Here is an example.
public class HostActivity extends Activity {
private MyFragment myFragment;
protected void onActivityResult(...) {
super.onActivityResult(...);
this.myFragment.onActivityResult(...);
}
}
At some point in your HostActivity
you will need to assign this.myFragment
the Fragment
you are using. Or, use the FragmentManager
to get the Fragment
instead of keeping a reference to it in your HostActivity
. Also, check for null
before you try to call the this.myFragment.onActivityResult(...);
.