Reputation: 1230
i want to create new file iam using this code
try {
File file = new File(Environment.getExternalStorageDirectory() + File.separator + "Contacts.vcf");
file.createNewFile();
} catch (IOException ioe)
{ioe.printStackTrace();}
and using this permission
<permission android:name="android.permission.MOUNT_FORMAT_FILESYSTEMS" ></permission>
but it keeps givinh me exeption that says Permission denied
Upvotes: 1
Views: 1276
Reputation:
add this permission into your manifest file
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Upvotes: 1
Reputation: 11909
Give WRITE_EXTERNAL_STORAGE permission to your AndroidManifest file as shown below:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
.........
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
Upvotes: 0
Reputation: 40426
when you write any file in External Storage(SD CARD) or Internal Storage
,You have to add permission in manifest file...
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Upvotes: 2
Reputation: 3937
you need to use this permission in manifest file
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Upvotes: 4