Dear, Please help before I have no more hair on my head!
Firstly, here is my code:
private void copyDatabase() {
if(!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())){
Toast.makeText(this, "External SD card not mounted", Toast.LENGTH_LONG).show();
}
try {
InputStream in = getAssets().open("Asset_Directory");
File outFile = new File(Environment.getExternalStorageDirectory() + File.separator + "Asset_Directory");
outFile.createNewFile();
OutputStream out = new FileOutputStream(outFile);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
out.close();
in.close();
Log.i("AssetCaptureActivity","Database has been transferred");
} catch (IOException e) {
Log.i("AssetCaptureActivity","Could not open the file");
}
}`
As you can see: I copied the database file to the Assets folder. Now I want to copy it to a virtual SD card so that I can edit the database. I have added WRITE permissions to my manifest. I read that I need to change something in the [run configuration] setting, but what?
I keep getting permission denied and he says my SD card is not installed.
Please, help!
source
share