• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Issue with loading image

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am trying to retrieve all images in the specific folder,For that I created a vector and move that images to that vector, the code I used is

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;
}
now I want to retrieve the elements from the vector and convert it to image,

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);
}
It shows an exception Abc,jpg cannot be read, Somebody please help me to sort it out....
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic