PDA

View Full Version : can we create a simple text file on BB??


Meenal
02-23-2007, 02:17 AM
Can we create a simple text file on the BB and then have our application access it?

jfisher
02-23-2007, 04:28 AM
on models with the 4.2 api yes as they have a filesystem, ie. the pearl and 8800.

do you need a txt file or just somewhere to store offline data? if you just need offline storage look into using the PersistentObject

dollars5
02-23-2007, 05:38 AM
as said by jfisher, yes and we already have a program doing it - multiPlay txtNotes

jfisher
02-23-2007, 05:49 AM
try something like this:

FileConnection filecon = (FileConnection)Connector.open("file:///SDCard/" + filename);

if(!filecon.exists()) {
filecon.create();
OutputStream out = filecon.openOutputStream();
out.write("mytextString");
out.close();
filecon.close();
}

if you need this in your project send me a pm and i'll email you the source code for this app: link>> txt notes app (http://jonathanhfisher.co.uk/software/blackberrymicronotes/index.htm)