Apps onRequestPermissionResulti in fragment
- By RioLeal
- Android Development
- 1 Replies
After beating up my head on the wall, I found the answer:
Inside the Fragment, I insert this code to Intent to call the camera:
And into MainActivity (which fragment belongs), I insert the code below:
I'll feel me so glad if this code could help someone else, because, in the Internet, help is so hard.
Inside the Fragment, I insert this code to Intent to call the camera:
Java:
Intent intent = new Intent(MediaStore.Action_IMAGE_CAPTURE);
// The number 1, below, is my code for camera
getActivity().startActivityForResult(intent, 1);
And into MainActivity (which fragment belongs), I insert the code below:
Java:
public void onActivityResult(int requestCode, int requestResult, @Nullable Intent data){
super.onActivityResult(requestCode, requestResult, data);
int result = requestCode;
}
I'll feel me so glad if this code could help someone else, because, in the Internet, help is so hard.
