I'm trying to take a picture from the gallery in the fragment, although it finds the path, I get a null pointer error while setting the bitmap, how can I edit this code
@Override
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 777 && resultCode == getActivity().RESULT_OK && data != null) {
Uri path = data.getData();
try {
bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), path);
imageView.setImageBitmap(bitmap);
imageView.setVisibility(View.VISIBLE);
} catch (IOException e) {
e.printStackTrace();
}
}
}