We have a USB port in our android tablet(version 4.0.3).
Pendrive File Systems Format are
- NTFS
- FAT32
When Pendrive File Systems Format are FAT32
File has been created Successfully. But When File Systems Format are NTFS
, I got the Error Message as open failed: EACCESS (Permission denied)
.
I Need to create a New File from in the USB Pendrive. I have tried my sample code is
Button createFile = (Button) findViewById(R.id.createFile);
createFile.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
try
{
File root = new File("/mnt/usbhost1");
Runtime.getRuntime().exec("chmod 777 " + root.getAbsolutePath());
File myFile = new File(root,"createNew.txt");
myFile.createNewFile();
Toast.makeText(getBaseContext(), "Done Creating File", Toast.LENGTH_SHORT).show();
}
catch (Exception e)
{
Toast.makeText(getBaseContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
}
}
});
Here /usbhost1
is a Android tablet USB Path. Where I am mistaken. How to create a New File from in the NTFS
File Systems Format.
Thanks in advance.
Regards
Bala