You must write onActivityResult()
in your FirstActivity.Java
as follows
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
}
So this will call your fragment's onActivityResult()
Edit: the solution is to replace getActivity().startActivityForResult(i, 1);
with startActivityForResult(i, 1);