Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Posts: 44
Registered: ‎08-20-2008
My Device: Not Specified

Image.createImage("/image") slow to fail

Working on some code to check for the presence of images as resources, or on the file system.  I'm noticing, however, that Image.createImage("/someResourceImageName") is really slow to fail.

 

Is there a fast way to check for the presence of a resource?  Alternatively, is it possible to get a list of available resources?  (Really these are general Java questions to which I should already know the answer.... :/)

 

Thanks in advance!

 

BlackBerry Development Advisor
Posts: 15,752
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Image.createImage("/image") slow to fail

This should fail rather quickly when accessing images within a cod file.  What BlackBerry model and handheld software version are you testing on?  You can find this under Options, About on the BlackBerry handheld.

 

If you want to check for images in the file system you can use a FileConnection and search for files with image extensions.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Highlighted
New Developer
Posts: 44
Registered: ‎08-20-2008
My Device: Not Specified

Re: Image.createImage("/image") slow to fail

AT&T 8820 and Verizion 8830 (Curve).  It's definitely way slow on both handsets

 

Is there a FileConnection.exists() method for resources?  This would solve my problem I think.

 

BlackBerry Development Advisor
Posts: 15,752
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Image.createImage("/image") slow to fail

The link below has sample code on reading resources directly.  This may thrown a NullPointerException quicker.

 

How To - Add plain text or binary files to an application
Article Number: DB-00148

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800620/How_To_...

 

However, there shouldn't be a delay in the createImage call.  What version of BlackBerry handheld software are you testing on?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 44
Registered: ‎08-20-2008
My Device: Not Specified

Re: Image.createImage("/image") slow to fail

8820 = v4.2.2.169 (Platform 2.4.0.67)

8330 = v4.3.0.127 (Platform 3.1.0.72)

 

Thanks for the tip.  I'll try to find some time to test directly reading the resources.