When I was tried to create a New File, I got a error message.
Code:
try
{
File root = new File(Environment.getExternalStorageDirectory().getAbsolutePath());
Runtime.getRuntime().exec("chmod 777 " + root.getAbsolutePath());
File myFile = new File(root,"createNew.txt");
myFile.createNewFile();
}
catch(Exception e)
{
Toast.makeText(getBaseContext(), e.getMessage(),Toast.LENGTH_SHORT).show();
}
Error Message:
java.io.IOException: open failed: EACCES (Permission denied)
/mnt/sdcard
Permission as d---------
How do change Permission through programmatically?How do solve. Give me any idea.
Thanks in advance.
Note this point:
When I was used this code in command prompt, file is created successfully, In that code is:
`chmod 777 /mnt/sdcard`