如何通过程序得到RootName: CFCard?
For example, the following code can be used to create a new file on a file system, where CFCard is a valid existing file system root name for a given implementation:
try {
FileConnection fconn = (FileConnection)Connector.open( "file:///CFCard/newfile.txt ");
// If no exception is thrown, then the URI is valid, but the file may or may not exist.
if (!fconn.exists())
fconn.create(); // create the file if it doesn 't exist
fconn.close();
}
catch (IOException ioe) {
}
------解决方案--------------------------------------------------------
FileSystemRegistry.listRoots()
------解决方案--------------------------------------------------------
被楼上的抢先了,我就来解说下吧
一般,手机存储为C: 存储卡为 E:
同时,还提供一个别名来访问,分别是 手机存储 和 存储卡
也就是说,在FileSystemRegistry.listRoots()结果中有4项
------解决方案--------------------------------------------------------
不理解。支持。学习了。谢谢Lz、!
------解决方案--------------------------------------------------------
顶下
------解决方案--------------------------------------------------------
学习
------解决方案--------------------------------------------------------
List list = new List( "List ", List.IMPLICIT);
Enumeration enumeration = FileSystemRegistry.listRoots();
if (enumeration.hasMoreElements()) {
list.append(enumeration.nextElement().toString(), null);
}
display.setCurrent(ist);