Android - How To Copy The Image To Folder In Sdcard
In my application i am downloading images from the web and these images will be stored in the sdcard. Here i am using the url as file name. For this first i am checking the file na
Solution 1:
just add permission to AndroidManifest.xml file and check, it may work.
<uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Solution 2:
You should always check whether SD storage is available before accessing it. If it's not, you can inform the user about failure instead of crashing application. Here's the function I'm using:
publicstaticbooleanstorageAvailable()
{
String state = Environment.getExternalStorageState();
if (!Environment.MEDIA_MOUNTED.equals(state)) returnfalse;
returntrue;
}
There's also possibility you forgot to add required permission into AndroidManifest.xml:
<uses-permissionandroid:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Post a Comment for "Android - How To Copy The Image To Folder In Sdcard"