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
New Developer
Posts: 2
Registered: ‎11-20-2008
My Device: Not Specified

Create file xml, succeessful on simulator but failed on device

Hi all,

i am trying to create file xml on SDCard. It is successful on simulator but when i deploy the app to device, the file creation failed. Does any body know how to solve it or something wrong with my code ?

Note that my app has been signed with RRT, RBB, RCR

here is part of my code :

private String sdCard = "file:///SDCard/BlackBerry/";
private boolean fileExists;

public void open(String fileName) throws Exception{
this.fileName = fileName;
fConn = (FileConnection)Connector.open(sdCard+fileName, Connector.READ_WRITE);
this.fileExists = fConn.exists();
}

public void write(String content) throws Exception{
if(fileExists){
fConn.delete();
}
fConn.create();
fConn.setWritable(true);
outStream = fConn.openOutputStream();
outStream.write(content.getBytes());
//outStream.flush();
}

public boolean fileExists(){
return fileExists;
}
BlackBerry Development Advisor
Posts: 15,070
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: Create file xml, succeessful on simulator but failed on device

Can you elaborate on your failure?  What doesn't work?  Is an exception thrown?  If so, what is it and what line triggers it?

 

What version of the BlackBerry JDE are you using?  What BlackBerry model and handheld software version are you testing on?  This can be found under Options, About on the BlackBerry handheld.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker