I have created an android application which downloads images from URLs given and download and save it into my sdcard. The image is to be saved into /mnt/sdcard/TempImages folder. and the image is then loaded into imageview for viewing it in my android activity. Till, today morning the application was working very fine, but from today morning onward, when I try to run the application, the image cannot be viewed in my activity. I have been loading the images from my own web server and I have given full permission for read or write access to the files in the server. So there is no problem from the server side. The problem is from the client side. This is the error log while trying to run the application. How should I add permission for my application in the /mnt/sdcard/TempImages folder for read and write access.

W/System.err(458): java.io.FileNotFoundException: /mnt/sdcard/TempImages/-1267781495 (Permission denied)
有帮助吗?

解决方案

Make sure your app has the proper permissions to be allowed to write to external storage:

It should look something like this in your manifest file:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

其他提示

add WRITE_EXTERNAL_STORAGE permission in manifest

Make sure you add the correct permission on your app manifest

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top