I am taking picture using camera intent in a fragment. On some devices it works perfect but on some devices my fragment get closed after taking picture.
Here is my code of calling camera intent:
Intent picIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
getActivity().startActivityForResult(picIntent, Constants.TAKE_PICTURE_SIGN_UP);
Here is my MainActivity's onActivityResult:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == Constants.TAKE_PICTURE_SIGN_UP || requestCode == Constants.SELECT_PICTURE_SIGN_UP)
{
SignUpFragment frag = (SignUpFragment)getSupportFragmentManager().findFragmentByTag(Constants.SignUpFragmentTag);
if(frag != null && frag.isVisible())
{
frag.onActivityResult(requestCode, resultCode, data);
}
}
}
When I select picture from gallery it works fine but when I take picture from camera frag is null. What cause the problem here and how to solve it?