Is there a way to save the full size image returned from camera activity in internal memory?

I use

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(externalFileObj)); 

intent to trigger camera activity by default. To get the full image, you need to specify aim.putExtra (). But this always requires a URI that only works for external storage files.

I tried to create a temp.jpg image in internal memory and pass it a URI

 Uri.fromFile(new File(getFilesDir() + "/temp.jpg")); 

but camera activity will not go back after image capture.

So there’s no way to get a full-size image from the default camera application in our activity without using external storage? Assuming the device does not have an SD card or is currently in use, there is no way I can avoid using it?

Yes, I know that we can create our own camerapreview surface, but I want to use the default camera application, since it is natural when there are many other options.

Thanks.

+7
source share
2 answers

Oh! I understood. The file directory in the internal memory is closed by default and is not writable by external applications (for example, the camera application is an external application)

Just create a new directory in recording mode in your application space (internal memory) and transfer this URI to the camera action. And everything is working fine. No need for external storage. Tested and works great.

+1
source

I just used the code as shown below:

 mTempFilePath = File.createTempFile("myappprefix_", ""); i.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(mTempFilePath)); 

Is there any reason this should be in internal storage? I would expect that only phones like HTC Incredible (with internal photo storage) will be able to explicitly store photos on internal ones.

0
source

All Articles