2012-01-30 50 views
0

我的疑问和标题一样简单。BlackBerry 5.0查看目录内容

我有一个X目录,我即将有一些图像,我需要发送邮件中的每个图像的目录。

不知道如何检查目录的比赛,并列出它的每个文件,所以我可以通过邮件发送它。

是否有可能?

THX提前。

回答

1

如何:

try { 
    FileConnection fconn = (FileConnection)Connector.open("file:///SDCard/X"); 
    // If no exception is thrown, then the URI is valid, but the file may or may not exist. 
    if (fconn.exists() && fconn.isDirectory()) 
     Enumeration list = fconn.list(); 
     while (list.hasMoreElements()) { 
       String fname = (String)list.nextElement(); 
       //fname could be a file or a sub-directory ... 
     } 
     fconn.close(); 
} 
    catch (IOException ioe) { 
} 
+0

的作品就像一个冠军。 thx很多 – 2012-02-01 11:29:20

+0

不客气。 – Richard 2012-02-01 13:32:21