Results 1 to 3 of 3
Thread: Display image from filesystem
- 08-30-2009, 09:38 PM #1
Member
- Join Date
- Aug 2009
- Posts
- 2
- Rep Power
- 0
Display image from filesystem
I seem to have a problem displaying an image from the phone's filesystem.
The following code works for images that are in the res folder but not if the path references to a file on the filesystem ..
path = "file:///C:/Data/Images/200908/25082009004.jpg";
try {
image = Image.createImage(path);
} catch (IOException e) {
e.printStackTrace();
}
imageItem = new ImageItem(null,image,ImageItem.LAYOUT_CENTER,"Imag e not found");
form.append(imageItem);
Do I need to use an inputStream ?
If so, how ?
- 08-30-2009, 10:37 PM #2
You need the (optional) JSR-75: the FileConnection API. Note that this API is available on only a few high-end devices.
db
- 08-31-2009, 11:00 AM #3
Member
- Join Date
- Aug 2009
- Posts
- 2
- Rep Power
- 0
I actually AM using the FileConnection API (ok apparently I can't post the link to the site where I got the code because I don't have enough posts .. I'm gonna try to do it anyway by stripping some stuff, add .html after : j2mesamples.blogspot.com/2009/02/file-connection-using-j2me-api-jsr-75)
The thing is, if I'm in the else of the displayCurrentRoot function, that checkes whether the element of the file list is a folder or an item (jpg), I want it to display my image.
Normally it would just display the item's name with the currentDir variable like so :
append(currentDir,null);
Now I tried :
Image img = Image.createImage(currentDir);
append(currentDir,img);
which didn't work, so I tried the entire path :
String path = currentRoot.getURL() + currentDir;
Image img = Image.createImage(path);
append(currentDir,img);
Your help is appreciated !
Similar Threads
-
how to read an image and display
By santhosh_el in forum AWT / SwingReplies: 2Last Post: 04-04-2009, 12:43 PM -
can display image in JFrame?
By xCLARAx in forum AWT / SwingReplies: 14Last Post: 04-03-2009, 07:02 PM -
How to display image ?
By Birkoff in forum AWT / SwingReplies: 7Last Post: 06-09-2008, 07:58 AM -
How to display an image in JApplet
By fred in forum Java AppletsReplies: 1Last Post: 07-24-2007, 02:02 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks