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:
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.