Tuesday, May 02, 2006

Reading and Writing files to the SD card on the a780

Just in case you needed to read/write files to the SD card on the a780, I just came across how to do that today. It's not really documented anywhere although if you use the "listRoots()" method you can find it out. Note that it's "SD" and not "SDCard" as the JSR would lead you to believe.

FileConnection sc = (FileConnection)Connector.open("file:///SD/myFile.txt");
OutputStream os = sc.openOutputStream();


Blogger Frank said...

A slight correction to this. If the SD card was renamed, it wouldn't show up as /SD/ You could use code like this to identify it since there are only two roots on the A780...

String[] roots = FileSystemRegistry.listRoots();
String sdroot = null;
for (int i=0;i<roots.length;i++) {
if (!roots[i].equals("/phone/")) {
sdroot = roots[i];
FileConnection fc = (FileConnection)Connector.open("file://" + sdroot + "tmp.txt");

11:29 AM  
Blogger Mr. said...

Cool, thanks!

10:08 AM  
Blogger Jaun Law said...

Very nice thanx!

5:45 AM  
Anonymous Anonymous said...

I think this is the best blog I have been through all this day.
how to get free minecraft

1:02 AM  
Blogger Firoz Khan said...

Such a nice blog. I really enjoyed reading it.
iphone data recovery
recover iphone contacts
recover deleted text messages iphone

3:41 AM  
Blogger sir kodak said...

I'd be trampled if all sites gave articles like these awesome articles.download

8:35 AM  

Post a Comment

<< Home