Hello everyone!
I'm developing a feature to save picture with mobile camera and I have a problem with override method onActivityResult(), it is never called:
My class extends AppCompatDialogFragment.
I'm developing a feature to save picture with mobile camera and I have a problem with override method onActivityResult(), it is never called:
Java:
private void checkPermissionAndOpenCamera(Activity activity)
{
if (ContextCompat.checkSelfPermission(activity, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED)
{
ActivityCompat.requestPermissions(activity, new String[]{Manifest.permission.CAMERA}, 100);
return;
}
openCamera();
}
private void openCamera() {
//startActivityForResult(intent, IMAGE_CAPTURE_RESULT);
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, IMAGE_CAPTURE_RESULT);
}
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
Toast.makeText(getActivity(), "ENTROU EM RESULT FUNCTION", Toast.LENGTH_LONG).show();
if (resultCode == RESULT_OK)
{
Toast.makeText(getActivity(), "Picture!", Toast.LENGTH_LONG).show();
}
}
My class extends AppCompatDialogFragment.