I am using midp 2.0. Here, I am using FileConnection for read and write files on mobile memory. I am able to read and write files on mobiles successfully. But while I am trying to write file data on mobile, it asking message like below.
Application wants to read from the local file system
is it OK to read your files?
if I press yes, then it again shows
Application wants to write to the local file system
is it OK to update your files?
These message are continuously showing approximately 10 times.
Is there any way to prevent this repeating this more than one time?
I have included my fileWrite method for your reference also:
public String fileWrite(String root)
{
FileConnection fc = null;
String fName = "test.txt";
DataOutputStream dos=null;
try
{
fc = (FileConnection) Connector.open(root + fName, Connector.READ_WRITE);
if(!fc.exists())
{
fc.create();
}
else
{
System.out.println("File Exists part");
fc.delete();
fc.create();
}
dos = fc.openDataOutputStream();
dos.write("f".getBytes());
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
try
{
fc.close();
dos.close();
}
catch (IOException e) { }
}
return "Saved in "+root+fName;
//return "NULL";
}//filewrite ends here*/
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…