BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-22-2008, 09:34 AM   #1
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
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, 10:14 AM   #2
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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, 10:35 AM   #3
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
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 10:37 AM..
Offline  
Old 07-22-2008, 10:45 AM   #4
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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, 10:48 AM   #5
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
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 10:55 AM..
Offline  
Old 07-22-2008, 12:45 PM   #6
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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, 01:08 PM   #7
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

Have you read the knowledge base article on this?

How To - Define a rollover icon for an application.
Offline  
Old 07-23-2008, 02:50 AM   #8
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
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, 02:59 AM   #9
pwaugh
Knows Where the Search Button Is
 
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: at&t
Posts: 40
Default

What part do you not understand? Ask a question we can answer, or post your code.
Offline  
Old 07-23-2008, 03:25 AM   #10
VegetableBird
New Member
 
Join Date: Jul 2008
Model: 8100
PIN: N/A
Carrier: 8-)
Posts: 9
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, 03:58 AM   #11
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Square D 31074-400-44 Magnet Coil Size 3 208 Volt AC New picture

Square D 31074-400-44 Magnet Coil Size 3 208 Volt AC New

$225.00



12V Solenoid Electrical Coil 6302012 for HydraForce Series 08/80/88/98 1/2” Hole picture

12V Solenoid Electrical Coil 6302012 for HydraForce Series 08/80/88/98 1/2” Hole

$20.47



VEVOR 3/4

VEVOR 3/4" - 500' coil-BLUE Certified PEX Tubing Htg/Plbg/Potable Water

$168.99



1100-0541 6 Volt Ignition Coil for Ford Tractor 2N 8N 9N Front Mount 9N12024 picture

1100-0541 6 Volt Ignition Coil for Ford Tractor 2N 8N 9N Front Mount 9N12024

$27.36



D4PE12029AA 6 Volt Ignition Coil Fits Ford/New Holland Tractor 600 700 800 picture

D4PE12029AA 6 Volt Ignition Coil Fits Ford/New Holland Tractor 600 700 800

$26.44



Ignition Coil for Ford Tractor 12V 2000 3000 4000 5000 Naa600 800 1965 & Up D5TE picture

Ignition Coil for Ford Tractor 12V 2000 3000 4000 5000 Naa600 800 1965 & Up D5TE

$26.38







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