0
votes

I saved my image URI to splite and when I open my app, my app opens SQLite and gets the image URI.

But, when I get my image URI from my splite, this content Error occurs:

Unable to open content: content://com.android.providers.media.documents/document/image%3A6230

java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{86b9c15 17060:com.example.text/u0a254} (pid=17060, uid=10254) requires android.permission.MANAGE_DOCUMENTS or android.permission.MANAGE_DOCUMENTS

My app code:

String allset=dbHelper.loadresult();// load db and get data
String[] data = allset.split(":"); // parse
String loadImgPath=data[2]; // load uri string
image1.setImageURI(Uri.parse(loadImgPath2));



image1.setImageURI << this is error
1
Instead of uri, try to use byte[] and store that in blob type in SQLite. Hope this will help you. - Nitin Patel

1 Answers

0
votes

add <uses-permission android:name="android.permission.MANAGE_DOCUMENTS" /> on the above of <application> tag in your AndroidManifest.xml file

and then check if your target and compile sdk is higher than lolipop then refer this link