Note that there are some explanatory texts on larger screens.

plurals
  1. POCant able to delete a file in SD card using file connection -- Blackberry
    primarykey
    data
    text
    <p>I have developed a blackberry app in which i have video control to capture image then i save the images in the root directory in my desired name and displaying the the screen... in the re-capture button click i am again capturing the image once again and i am deleting the previous image and saving the new image in the same name in the same path using the file connection. My problem is its works fine in emulator. But when i tested in device, it throws me error when i try to delete the previous image to save the new image.. it throws "net.rim.device.api.io.file.fileioexception: the file is currently in use" .. please help me.. </p> <hr> <p>@arhimed, @juanmabaiu This is the function where it goes to catch and throws exception when tested in device.</p> <pre><code> public void fieldChanged( final byte[] _raw ) { try { flag ++; // Create the connection to a file that may or // may not exist. FileConnection file = (FileConnection)Connector.open(FILE_NAME + "_front" + EXTENSION); // If the file exists, increment the counter until we find // one that hasn't been created yet. while( file.exists() ) { file.delete(); file = (FileConnection)Connector.open( FILE_NAME + "_front" + EXTENSION ); } //FileConnection file_temp = (FileConnection)Connector.open(FILE_NAME + "tempimg" + EXTENSION); //file_temp.delete(); // We know the file doesn't exist yet, so create it file.create(); // Write the image to the file OutputStream out = file.openOutputStream(); out.write(_raw); // Close the connections out.close(); file.close(); //Dialog.inform( "Saved to " + FILE_NAME + "_front" + EXTENSION ); } catch(Exception e) { home.errorDialog("ERROR " + e.getClass() + ": " + e.getMessage()); Dialog.inform( "File not saved this time"); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload