BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-22-2008, 10:34 AM   #1 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Change Icon

Please Login to Remove!

Hi everyone.

First I know that there is several threads about it but no one helped me.

So my question is how canI simply change the application's icon when it gets focus???

Or if anyone could explain me this :

Livelink - Redirection
Offline  
Old 07-22-2008, 11:14 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Use HomeScreen.updateIcon() to change the default icon for your applicatin.
Use HomeScreen.setRolloverIcon() to change the icon that is displayed when the cursor is rolled over your icon. Note that this is 4.2& up, doesn' work on older revs of OS.
Offline  
Old 07-22-2008, 11:35 AM   #3 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I work on 4.3 so no version problem.

But where on my code I have to put the HomeScreen.setRolloverIcon()????

If I just try this on my main:

Bitmap icon = Bitmap.getBitmapResource("Logo2.png");
HomeScreen.setRolloverIcon(icon);
Test2 theApp = new Test2();
theApp.enterEventDispatcher();

Nothing appends

Last edited by goulamass : 07-22-2008 at 11:37 AM.
Offline  
Old 07-22-2008, 11:45 AM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

Test "icon" and make sure it is not null - getBitmapresource() will fail if the "png" file is not located in the root of the project.
Offline  
Old 07-22-2008, 11:48 AM   #5 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

No pb with because I'm sure that the logo is added to the project and not null.

And I just have to specify Logo2.png to access it as I do for the home picture.

So I check it and no pb I can add it to the screen by the following :

BitmapField picture = new BitmapField(bmp.getBitmapResource("Logo2.png"));
add(picture);

And so I look into the icon and I have this :

icone net.rim.device.api.system.Bitmap@dbe364a

So I'm sure that icon is not null

Last edited by goulamass : 07-22-2008 at 11:55 AM.
Offline  
Old 07-22-2008, 01:45 PM   #6 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

so, the icon should change to logo2.png when you roll over it (with the cursor) on the BB Home screen. Is this not occurring?
Offline  
Old 07-22-2008, 02:08 PM   #7 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Have you read the knowledge base article on this?

How To - Define a rollover icon for an application.
Offline  
Old 07-23-2008, 03:50 AM   #8 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes as I give the link in my first post.

But I'm not sure that I understand the way I have to following.

So if you can explain me or show an exemple, it will be helpfull
Offline  
Old 07-23-2008, 03:59 AM   #9 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: at&t
Posts: 40
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

What part do you not understand? Ask a question we can answer, or post your code.
Offline  
Old 07-23-2008, 04:25 AM   #10 (permalink)
New Member
 
Join Date: Jul 2008
Model: 8100
PIN: N/A
Carrier: 8-)
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is a sample:
Code:
import net.rim.blackberry.api.homescreen.HomeScreen;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;

public class HelloWorld extends UiApplication {
	public static void main(String[] args) {
		final HelloWorld theApp = new HelloWorld();
		if (HomeScreen.supportsIcons()) {
			System.out.println("supportsIcons  == true");
			Bitmap icon1 = Bitmap.getBitmapResource("icon1.png");
			Bitmap icon2 = Bitmap.getBitmapResource("icon2.png");
			HomeScreen.updateIcon(icon1);
			HomeScreen.setRolloverIcon(icon2);
		} else {
			System.out.println("supportsIcons  == false");
		}
		theApp.enterEventDispatcher();
	}

	public HelloWorld() {
		pushScreen(new HelloWorldScreen());
	}
}

class HelloWorldScreen extends MainScreen {
	public HelloWorldScreen() {
		super(DEFAULT_MENU | DEFAULT_CLOSE);

		setTitle(new LabelField("Hello world demo", LabelField.ELLIPSIS
				| LabelField.USE_ALL_WIDTH));
	}
}
Wish it's helpful.
Offline  
Old 07-23-2008, 04:58 AM   #11 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

You're right it was very helpfull.

But it works only when I started the application before.

Is there anyway to do this each time????
Offline  
Closed Thread


Thread Tools

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.