BlackBerryForums.com : Your Number One BlackBerry Community  
   

»Sponsored Links



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
goulamass Offline
Thumbs Must Hurt
 
Posts: 146
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Default Change Icon - 07-22-2008, 09:34 AM

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
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
Dougsg38p Offline
Thumbs Must Hurt
 
Posts: 83
Join Date: Mar 2008
Location: Austin, TX
Model: 8320
PIN: N/A
Carrier: T-Mobile
Default 07-22-2008, 10:14 AM

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.
   
Reply With Quote
  (#3 (permalink)) Old
goulamass Offline
Thumbs Must Hurt
 
Posts: 146
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Default 07-22-2008, 10:35 AM

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.
   
Reply With Quote
  (#4 (permalink)) Old
Dougsg38p Offline
Thumbs Must Hurt
 
Posts: 83
Join Date: Mar 2008
Location: Austin, TX
Model: 8320
PIN: N/A
Carrier: T-Mobile
Default 07-22-2008, 10:45 AM

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.
   
Reply With Quote
  (#5 (permalink)) Old
goulamass Offline
Thumbs Must Hurt
 
Posts: 146
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Default 07-22-2008, 10:48 AM

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.
   
Reply With Quote
  (#6 (permalink)) Old
Dougsg38p Offline
Thumbs Must Hurt
 
Posts: 83
Join Date: Mar 2008
Location: Austin, TX
Model: 8320
PIN: N/A
Carrier: T-Mobile
Default 07-22-2008, 12:45 PM

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?
   
Reply With Quote
  (#7 (permalink)) Old
hrbuckley Offline
Thumbs Must Hurt
 
Posts: 154
Join Date: Jan 2006
Model: 8820
Carrier: Rogers
Default 07-22-2008, 01:08 PM

Have you read the knowledge base article on this?

How To - Define a rollover icon for an application.
   
Reply With Quote
  (#8 (permalink)) Old
goulamass Offline
Thumbs Must Hurt
 
Posts: 146
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Default 07-23-2008, 02:50 AM

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
   
Reply With Quote
  (#9 (permalink)) Old
pwaugh Offline
Knows Where the Search Button Is
 
Posts: 39
Join Date: Mar 2008
Model: 8820
PIN: N/A
Carrier: at&t
Default 07-23-2008, 02:59 AM

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

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.
   
Reply With Quote
  (#11 (permalink)) Old
goulamass Offline
Thumbs Must Hurt
 
Posts: 146
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Default 07-23-2008, 03:58 AM

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????
   
Reply With Quote
Reply


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-2008 BlackBerryNews.com, BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.1