I have a Fragment that calls another Activity using:
ProductEditionMaintenanceActivity.class);
Bundle extras = new Bundle();
extras.putString("productCode", productCode);
extras.putInt("productEditionID", 0);
intent.putExtras(extras);
getActivity().startActivityForResult(intent, 1);
and return from the activity:
Intent resultIntent = new Intent();
setResult(Activity.RESULT_OK, resultIntent);
finish();
I tried to use the following in the Fragment
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
//Do something
}
However, I am guessing the intent created passed the reference of the parent Activity of the Fragment therefore onActivityResult on the Fragment does not get called. If that is the case, what do I need to do so the fragment get the result from the callee Activity?
The fragments onActivityResult
will get called AFTER the host activities onActivityResult
as long as super.onActivityResult
is called from the host activity. See https://stackoverflow.com/a/6147919/552902 for more detail
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With