I'm new to Android and Java. I'm trying to take a photo from the camera, and update an imageview with the result. I'm struggling and could use some points in the right direction.
I've set up an empty Uri variable:
Uri cameraOneUri = Uri.EMPTY;
My button click calls this function:
public void captureImage1(View view){
c1GetContent.launch(cameraOneUri);
}
And here's the registration:
ActivityResultLauncher<Uri> c1GetContent = registerForActivityResult(new ActivityResultContracts.TakePicture(),
result -> {
ImageView imageView1 = findViewById(R.id.imageView1);
imageView1.setImageURI(cameraOneUri);
});
But I'm getting a FileNotFoundException: No content provider:
java.io.FileNotFoundException: No content provider:
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1846)
at android.content.ContentResolver.openOutputStream(ContentResolver.java:1562)
at android.content.ContentResolver.openOutputStream(ContentResolver.java:1537)
at com.android.camera.captureintent.state.StateSavingPicture.onEnter(StateSavingPicture.java:85)
at com.android.camera.captureintent.stateful.StateMachineImpl.jumpToState(StateMachineImpl.java:62)
at com.android.camera.captureintent.stateful.StateMachineImpl.processEvent(StateMachineImpl.java:110)
at com.android.camera.captureintent.state.StateOpeningCamera$9.onClick(StateOpeningCamera.java:307)
Where should I begin to look?