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

Reply
Trusted Contributor
coilfyzx
Posts: 204
Registered: ‎07-03-2011
My Device: Torch
Accepted Solution

Create a folder in a specific location

NOOB ALERT.

 

Haha. Hello thanks for taking the time to try and help me. I am looking how to create folders with my application in specfic locations. i am a total novice, and I don't know where to start. How do I do that with code. I want my app to create it's own folder for storing files and other things. Is there any code out there that could help me, because I LOVE direct answers(maybe I'm asking too much of you). But I would love a simple example. I will post whatever information I have implemented regarding this if I can.

 

Thank you again. Cheers

_______________________________________________________
Never be close-fisted with the knowledge you've received. For if others were the same to you, you would not be painted as the person you are; the flowing definition of you, would be non existent.

You would be meaningless.
Developer
tommy20
Posts: 262
Registered: ‎05-18-2011
My Device: Curve 9300, BB10 Dev Alpha C, Z10

Re: Create a folder in a specific location

	static void createFolder(String folder) {
		FileConnection filecon = null;
		try {
			filecon = (FileConnection) Connector.open(folder, Connector.READ_WRITE);
			if (!filecon.exists()) {
				filecon.mkdir();
			}
		} catch (IOException ioe) {
			System.out.println("ERROR");
		} finally {
			try {
				if (filecon != null) {
					filecon.close();
				}
			} catch (IOException e) {
				System.out.println("ERROR");
			}
		}
	}
...

createFolder("file:///SDCard/blabla");

 

--tom
Trusted Contributor
coilfyzx
Posts: 204
Registered: ‎07-03-2011
My Device: Torch

Re: Create a folder in a specific location

Thanks a lot man! However could you explain it briefly, just so I don't fall for the copy and paste syndrome
_______________________________________________________
Never be close-fisted with the knowledge you've received. For if others were the same to you, you would not be painted as the person you are; the flowing definition of you, would be non existent.

You would be meaningless.