Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 42
Registered: ‎03-03-2009
My Device: 9600
My Carrier: Vodafone
Accepted Solution

Can't able to create Custom Folder in SDCard (Memory card) for storing images into it.

Hi All,

          I have successfully create one folder (my custom folder) into blackberry inbuild media picture folder.

 

         But when i am trying to create same folder in memorycard (SDCard) then it doesn't create the folder.

 

         I am working on 8520 simulator with 4.7 JDE. Below is my code sample 

 

         1) for creating folder (Tej /tejas.bmp) into  Inbuilt Picture media ( Successfully created ): -

 

        try {
                  
                        FileConnection file = (FileConnection) Connector.open(System.getProperty("fileconn.dir.photos")+ "Tej/tejas.bmp",Connector.READ_WRITE);
                            while (file.exists()) {
                                   file.close();
                            }
                        file.create();
                        out = file.openOutputStream();
                      
                        // Close the connections.
                        out.write(data,0,data.length);
                        out.close();
                       
                        file.close();
                      
                        System.out.println("File Write Successfully");
                   
                    } catch (Exception e) {
                        System.out.println("Exception in FileConnection Write:"+e.getMessage());
                    }

 

             2) for creating folder (Tej /tejas.bmp) into  MemoryCard (SDCard) Picture media (Not able to creat ): -

 

               try {
                  
                         FileConnection file = (FileConnection) Connector.open(System.getProperty("fileconn.dir.memorycard.photos")+ "Tej/tejas.bmp",Connector.READ_WRITE);


                            while (file.exists()) {
                                   file.close();
                            }
                        file.create();
                        out = file.openOutputStream();
                      
                        // Close the connections.
                        out.write(data,0,data.length);
                        out.close();
                       
                        file.close();
                      
                        System.out.println("File Write Successfully");
                   
                    } catch (Exception e) {
                        System.out.println("Exception in FileConnection Write:"+e.getMessage());
                    }

 

          Please give any code reference if i am wrong in  2nd case . Otherwise tell me if any setting needs to be done to create folder into sdcard (in this case , i am using my PC as SDCard ).

Tejas Barbhaya

Logistic Infotech
tej.barbhaya@gmail.com
www.logisticinfotech.com
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Can't able to create Custom Folder in SDCard (Memory card) for storing images into it.

[ Edited ]

Can you post questions like thi sin the java forum:

http://supportforums.blackberry.com/t5/Java-Development/bd-p/java_dev

 

Can you please dump out the file name generated when you write to the SDCard, for example change

 

FileConnection file = (FileConnection) Connector.open(System.getProperty("fileconn.dir.memorycard.photos")+ "Tej/tejas.bmp",Connector.READ_WRITE);

 

to

 

String fileName = System.getProperty("fileconn.dir.memorycard.photos")+ "Tej/tejas.bmp";

System.out.println("SDCARD File Name: " + fileName );

FileConnection file = (FileConnection) Connector.open(fileName,Connector.READ_WRITE);

 

Could you also please give us the text of the Exception that you see, i.e. the output from:

System.out.println("Exception in FileConnection Write:"+e.getMessage());

 

Cheers

Developer
Posts: 42
Registered: ‎03-03-2009
My Device: 9600
My Carrier: Vodafone

Re: Can't able to create Custom Folder in SDCard (Memory card) for storing images into it.

Hi ,

      I am getting exception like "File System Error"

 

Thanks,

Tej

Tejas Barbhaya

Logistic Infotech
tej.barbhaya@gmail.com
www.logisticinfotech.com
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Can't able to create Custom Folder in SDCard (Memory card) for storing images into it.

There are a number of Threads on this forum that talk about that Exception.  Can I suggest you review these to see if any of them is applicable?

Developer
Posts: 42
Registered: ‎03-03-2009
My Device: 9600
My Carrier: Vodafone

Re: Can't able to create Custom Folder in SDCard (Memory card) for storing images into it.

Thanks after searching a lot , i got that it will work in device but not in simulator and fortunatelly it correct.

Tejas Barbhaya

Logistic Infotech
tej.barbhaya@gmail.com
www.logisticinfotech.com