我试图找回在特定文件夹中的所有图像,对于我创建了一个矢量并移动图像到矢量,我使用的代码是问题与加载图像
imageNameVector.removeAllElements();
try {
FileConnection fc = (FileConnection)Connector.open("file:///e:/Images", Connector.READ_WRITE);
if(!fc.exists())
{
fc.mkdir();
}
Enumeration filelist = fc.list("*.jpg", true);
String filename;
while(filelist.hasMoreElements()) {
filename = (String) filelist.nextElement();
imageNameVector.addElement(filename);
}
fc.close();
}
catch (IOException ioe)
{
System.out.println("IOException: "+ioe.getMessage());
}
catch (SecurityException se) {
System.out.println("SecurityException: "+se.getMessage());
}
System.out.checkError();
return imageNameVector;
}
现在我想找回从向量元素并将其转换成图像,
imageName = (String) imageNameVector.elementAt(1);
try{
image = Image.createImage(imageName);
}catch(Exception e){
Alert alert = new Alert("Sngjfkgnlkjf") ;
alert.setString(""+imageName+e);
display.setCurrent(alert);
}
它显示了一个异常ABC,JPG不能被读取,有人请帮我整理出来....