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();
FileConnection sc = (FileConnection)Connector.open("file:///SD/myFile.txt");
OutputStream os = sc.openOutputStream();
5 Comments:
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");
Cool, thanks!
Very nice thanx!
____________
lto2
I think this is the best blog I have been through all this day.
how to get free minecraft
I'd be trampled if all sites gave articles like these awesome articles.download
Post a Comment
<< Home