BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-27-2010, 05:23 AM   #1 (permalink)
New Member
 
Join Date: Aug 2010
Model: 9550
PIN: N/A
Carrier: 1
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Post Writing data to a file in SDCard

Please Login to Remove!

Hi,
I want to write text to a file in SDCard. The code is below:

public EditField editfield;
public String filepath="file:///SDCard/BlackBerry/documents/Test.txt";


try
{
FileConnection fconn=(FileConnection)Connector.open(filepath,Conn ector.READ_WRITE);
if(!fconn.exists())
{
fconn.create();
}
OutputStream os=fconn.openOutputStream();
os.write(editfield.getText().getBytes());
os.close();
fconn.close();

catch(IOException ioe)
{

}


When I debug the code the file got created;but when i entered some text data in simulator the data is not written in the file.(No Exception/Errors)
Whether I want to click save menu button??I'm not getting it!!
Can anyone help me on this.
If possible i want sample code to read data from the same file.
Offline  
Old 08-28-2010, 02:57 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: 7100t
PIN: N/A
Carrier: S/W Developer
Posts: 22
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Just change ur path you can not write any think in Blackberry folder.


"file:///SDCard/Test.txt";
__________________
Thanks & Regards
SKY
Offline  
Old 08-30-2010, 07:36 AM   #3 (permalink)
New Member
 
Join Date: Aug 2010
Model: 9550
PIN: N/A
Carrier: 1
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

We have to give the full path as given above..
Offline  
Old 09-16-2010, 09:20 AM   #4 (permalink)
New Member
 
RockoAndy's Avatar
 
Join Date: Sep 2010
Model: 8900
PIN: N/A
Carrier: Airtel
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey dude the path is file:///SDCard/blackberry/...

there is no folder called /BlackBerry/ .. use media/explore and chk it
__________________
the amazing world of
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.