You Are Here:

Community: Developer Discussion Boards

#1 Old Unhappy how to load image in java ? - 2006-02-27, 07:35

Join Date: Dec 2005
Posts: 22
saeidkhan
Offline
Registered User
how to load image in java ?
i want to load image but i cant please help me !

javax.microedition.lcdui.Image image1;
image1 = Image.createImage("C:/Nokia/Images/Pictuer/32.jpg");
Reply With Quote

#2 Old Re: how to load image in java ? - 2006-02-27, 11:14

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
You have to package the picture as part of the application, the phone/emulator don't have access to your computer's filesystem. Where exactly you need to put it depends on your build system, but usually you would have a "res" folder or something for your resources (like images and sounds). Then you load using the path inside the jar (so usually it would be something like "/32.jpg" or "/res/32.jpg", again, this depends on your build system).

shmoove
Reply With Quote

#3 Old Re: how to load image in java ? - 2006-03-22, 18:09

Join Date: Feb 2006
Posts: 16
chinsuvent
Offline
Registered User
if you want load image, you must put your image in "res" directory on your project. Than try this code :
javax.microedition.lcdui.Image image1;
image1 = Image.createImage("/32.jpg");
Reply With Quote

#4 Old Re: how to load image in java ? - 2006-03-31, 17:03

Join Date: May 2005
Posts: 19
queycn
Offline
Registered User
I dont think this work:
image1 = Image.createImage("/32.jpg");

J2me only support the png file.

Try to get the inputstream using :
this.getClass().getResourceAsStream(fileName);

in your class file, then you can use the decoder to proecess.

Hope it works.
Reply With Quote

#5 Old Re: how to load image in java ? - 2006-04-06, 16:53

Join Date: Apr 2006
Posts: 3
amr_alhossary
Offline
Registered User
there are more than one way to create image

1- createImage(String name) : used only to createimage from a resource image in the same jar

2- createImage(InputStream stream) : neaded to create image from a stream ... that can be obtained by either
this.getClass().getResourceAsStream(fileName) to get a file in the same jar
or
Connector.openConnection() to get a file on the file system if you have a (JSR75) implementation ..... i think that is what the question is asking about

3- createRGBImage(int[] rgb, int width, int height, boolean processAlpha) : used to create image from an int[] that contains the RGB values for the image points


for any questions send me back
amr_alhossary@hotmail.com
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
When I load image from jpeg it awry ramis55 General Symbian C++ 2 2005-11-29 13:25
It takes time to load image on incoming call rahulsingh Symbian Tools & SDKs 16 2005-07-05 09:24
HELP: Mutable Image to Immutable Image? rj_cybersilver Mobile Java Media (Graphics & Sounds) 1 2005-03-26 10:58
PNG Image won't load maaberge Mobile Java General 1 2003-11-16 19:13
image failed to load killarkai Mobile Java Media (Graphics & Sounds) 4 2003-07-25 14:07

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomhttpE3aE2fE2fdiscussionE2eforumE2enokiaE2ecomE2fforumE2fshowthreadE2ephpE3ftE3d18645X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE44iscussionQ qdcZtypeQUqfntypeZE44iscussionContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZentertainmentQ qfnZtopicQUqfnTopicZj2meQ qfnZtopicQUqfnTopicZjavaQ qfnZtopicQUqfnTopicZmediaQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE44iscussionQ qfnZtypeQUqfntypeZE44iscussionContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE44iscussionQ qrdfZtypeQUqfntypeZE44iscussionContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ