HI,
I am new in developing mobile applications and I hope you can help me for my problem. Currently, I am working on a kind of File Explorer for BB. That means the application enables to browse through the BB Store folders as well as the SD card - copy, rename, delete etc. files and directories.
In order to do this I use the FileConnection class. It works fine on the SD card. Howerver, if I want to edit files or directories (e.g. creating an new directory using FileConnection.mkdir() or only reading an image e.g. "file:///store/samples/pictures/image.jpg") in the BB store I always get a FileIOException.
I wonder if there are some special permissions for the BB store? How can I set the permission (FileConnection.setWriteable does not seem to work)?
Does anybody has any experiences storing content on the BB store?
Here my code:
Code:
//creating a directory
FileConnection fconn = (FileConnection)Connector.open(localPath);
try
{
fconn.mkdir();
fconn.setReadable(true);
fconn.setWritable(true);
}
catch(Exception ex)
{
System.out.println(ex);
}
// copy a file
FileConnection fconnFrom = (FileConnection)Connector.open(fromPath);
try
{
if (fconnFrom.exists())
{
fconnFrom.setReadable(true);
fconnFrom.setWritable(true);
int fileSize = (int) fconnFrom.fileSize();
DataInputStream dataIn = fconnFrom.openDataInputStream();
data = new byte[fileSize];
dataIn.read(data, 0, fileSize);
dataIn.close();
}
fconnFrom.close();
FileConnection fconnTo = (FileConnection)Connector.open(toPath);
if (!fconnTo.exists());
connTo.create(); // create the file if it doesn't exist
fconnTo.setReadable(true);
fconnTo.setWritable(true);
DataOutputStream dataOut = fconnTo.openDataOutputStream();
dataOut.write(data, 0, fileSize);
dataOut.close();
fconnTo.close();
}
catch(Exception ex)
{
System.out.print(ex);
}
THX for help in advance.
Happe
P.S. sorry for my bad english, I hope you got my problem.