хорошо, вот пример кода, который я сейчас использую в своем приложении для хранения данных на моей SDCard, посмотрите и попробуйте использовать это.
File newSoundFile;
ContentResolver mCr;
Log.e("check this tag","path for SDCard:"+Environment.getExternalStorageDirectory().getAbsolutePath());
//storing at: /mnt/sdcard/media
File directoryStructure=new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/Halloween");
//if directory doesn't exist create a directory if that fails too return false
if(!(directoryStructure.exists())){
if(!(directoryStructure.mkdirs())){
return false;
}
}
/*for(int allRing=0;allRing<ringId.length;allRing++)*/{
newSoundFile = new File(directoryStructure, "/"+HalloweenWallpaper.longPressSelected+".mp3");
Uri mUri = Uri.parse("android.resource://"+getApplication().getPackageName()+"/"+ringId[HalloweenWallpaper.longPressSelected]);
mCr = HalloweenWallpaper.this.getContentResolver();
AssetFileDescriptor soundFile;
try {
soundFile= mCr.openAssetFileDescriptor(mUri, "r");
} catch (FileNotFoundException e) {
soundFile=null;
Log.e("first check", "here --"+e.getMessage());
return false;
}
try {
byte[] readData = new byte[1024];
FileInputStream fis = soundFile.createInputStream();
FileOutputStream fos = new FileOutputStream(newSoundFile);
int i = fis.read(readData);
while (i != -1) {
fos.write(readData, 0, i);
i = fis.read(readData);
}
fos.close();
} catch (IOException io) {
Log.e("Second Check", "--"+io.getMessage());
return false;
}
}
//STORES SUCCESFULLY