Path Issue While Saving And Displaying An Image In Android
This might be my stupidity in writing paths but here is my code and it is failing to find configured root. getUriForFile is the one causing errors. @Override public void onClick(V
Solution 1:
I think you're following Android Developer documentation for this right? If you're not targeting Android N (Nougat), it is safe to remove the getUriForFile
line and modifyintent.putExtra(MediaStore.EXTRA_OUTPUT, mfileUri)
to intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(mPhotoFile))
.
According to Android developer documentation;
For more recent apps targeting Android N and higher, passing a file:// URI across a package boundary causes a FileUriExposedException. Therefore, we now present a more generic way of storing images using a FileProvider.
Post a Comment for "Path Issue While Saving And Displaying An Image In Android"