08-12-2008 09:44 PM
i'm trying to implement a "switch application" menu using getVisibleApplications to get the ApplicationDescriptor and from that appdescriptor.getIcon(). However, the icons it returns do not match the "real" application icon. Some are only B+W.
Some articles have sugguested that this is all getIcon can do but I have seen "switch application" commands in other 3rd party applications and the icons look fine there.
Is there another API that I should look at to get the correct icons? Is there a build in command to handle the entire switch application command (i know about alt-esc, but I would like a menu item).
08-15-2008 02:36 PM
I have a similar development task, and I agree that the icons are not identical to the images on the home screen or the ribbon. For example, the mail icon is a black & white line drawing of an envelope.
So, doing more research I switched to CodeModuleManager, using getHandle() and getApplicationDescriptor() to retrieve the icon from this direction.
Using this method, the icons are either B&W line drawings, or they come back from getIcon() as "null".
07-07-2009 05:10 AM
So is there a way to get a 'normal' application icons in any way ?
I use CodeModuleManager.getApplicationDescriptors(int handle) + getIcon() and almost all of the applications (with few notable exceptions) are black & white edge drawings.
Can someone confirm that it is impossible to get a full resolution, colored application icon (for instance: "address book" a.k.a "contacts") ?
Since we cannot access theme data, are we left stranded in drawing a non-theme look & feel ?
Too bad for the users of our applications.
07-07-2009 06:31 AM
The actual icons you see on the device for native applications come from the theme and not from the code module.
The icons you are getting are the B/W icons that date back to the time when there were no themes and BB could only support monochrome.
I have not tried this yet, but you should be able to get the icons from the current theme cod module. You can get the name of the active theme from the HomeScreen class, and then get the icon from the theme mdoule.
07-07-2009 06:37 AM
Yes, I noticed something that also leads to this conclusion...
Only a few of the 'native' applications' icons are not b/w (namely messenger, LBS ...) And all other 'native' applications are b/w.
On the other hand, all non-native applications expose their icen as they should.
Thank you for the tip about the themes, but do you have any code snippet we could use for such purpose ?
How do you suggest to access that cod module ?
07-07-2009 11:41 AM
Accessing cod module should be simple - Bitmap.getBitmapResource(String module, String name);
All you need is the name of the bitmap file as stored in the theme.
Some preliminary tests show the following nomenclature:
1. Take the name of the native module whose image you want (eg net_rim_bb_messaging_app)
2. Add the name of the arguments to the specific entry point (For example, the arguments for AppDesciptor of main messages app is "Messages") You can list out the application descriptors of a module using CodeModuleManager. Of course you would be interested only in the appdescriptors that do not have the "System" flag set. If the arguments is null, leave out this step.
3. If you want the focus icon, add "~focus".
4. Add png
So the resource name for default messags icon should be "net_rim_bb_messaging_app.Messages.png" and the focus icon should be "net_rim_bb_messaging_app.Messages~focus.png"
On a storm simulator the following code seems to work:
Bitmap bmp = Bitmap.getBitmapResource("net_rim_theme_precision_
07-08-2009 05:09 AM
Hmm... very intriguing finding.
First of all, I don't see whay the 'system' flag is of any importance... but, ok, this limitation does not bother me.
1) Secondly, how did you came about the second ('name') parameter of the getBitmapResource(String, String) method ?
2) Shouldn't theme's .cod contain all the icons that theme uses ?
3) To be more specific, how did you devise this construction: ".Messages~focus.png" ?
Thanks for providing another very interesting insight on this subject.
07-11-2009 06:26 AM
Does it work? I haven't tried it myself, I remembered it vaguely from pre 4.0 days when I was trying to make my application have a different rollover icon and the API didn't support it.
Also, to find this and a lot of other intriguing stuff all you need is:
1. The JDE Profiler tool
2. A lot of free time
03-16-2010 10:57 AM - edited 03-16-2010 11:18 PM
Cool Thanks! It works. However I noticed you need to parse out the name from the application theme, otherwise you will get the full path (e.g java:/net.rim.devie.internal.ui.theme.ThemeFactory
I do have another issue as well, the mail icon shows up but I haven't got any other applications to work properly running the debugger I get
FRIDG: could not find net_rim_bb_phone_app.Phone.png
FRIDG: could not find net_rim_bb_browser_daemon.Browser.png
Is there something that I am missing?