Reputation: 11
I am using this code to create some files on phone device, ex : txt, pdf...etc
try
{
File file = new File("myfile.txt");
if (file.createNewFile())
{
//throw new AdfException("crée", AdfException.INFO);
}
else
{
throw new AdfException("non crée", AdfException.INFO);
}
}
catch (IOException e)
{
throw new AdfException(e.getMessage(), AdfException.INFO);
}
but I have this error message: read only file system
Upvotes: 0
Views: 238
Reputation: 228
I think you need to create the files under your application folder
String dir = AdfmfJavaUtilities.getDirectoryPathRoot(AdfmfJavaUtilities.ApplicationDirectory);
String filePath= dir + "/myfile.txt";
try
{
File file = new File(filePath);
if (file.createNewFile())
{
//throw new AdfException("crée", AdfException.INFO);
}
else
{
throw new AdfException("non crée", AdfException.INFO);
}
}
catch (IOException e)
{
throw new AdfException(e.getMessage(), AdfException.INFO);
}
Upvotes: 1