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
Highlighted
New Developer
Posts: 2
Registered: ‎02-10-2009
My Device: Not Specified
Accepted Solution

Component Pack 4.7 - rollover icon doesn't change

Hello,

 

I'm using Eclipse.  Compiling with BB component pack 4.7.

 

I have a main project (CLDC) and a second project (CDLC Alternate Entry Point). The second project is checked system and startup.

note: The second entry point was to register a custom menu item for the app, not about the icon.

 

I right-click on the "main" Project->Properties->Blackberry Project Properties->Resources.

 

I select one icon file (1.png) in the "Icon Files" dialog.

 

I select a second icon file (2.png) in the "Focus Icon Files" dialog.

 

I clean, compile, run under a "new" Bold (9000) simulator, and my app has the "non-focus" icon. 

 

When I rollover it, it doesn't change.

 

From what I've read, 4.7 is supposed to make this easy.  It appears to be staightforward, so I am sure I am missing something that is obvious (to everyone but me).  I am new to Eclipse and Java, but have really been getting the hang of it....until now that is...Smiley Wink

 

Does anyone have ideas why this might not be working?

 

Thanks!

 

 

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Component Pack 4.7 - rollover icon doesn't change

You project has to have an additional entry point with parameter. This additional entry point has to be set as "Autostart". Add to the main entry point the parameter: gui

 

And check the code below. It works.

 

 

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.system.ApplicationManager;
import net.rim.blackberry.api.homescreen.HomeScreen;

public class HomeScreenIcon extends UiApplication
{
public static void main(String[] args)
{
//Check for the argument defined in the project properties.
if (args != null && args.length > 0 && args[0].equals("gui"))
{
HomeScreenIcon theApp = new HomeScreenIcon(false);
theApp.enterEventDispatcher();
}
else
{
HomeScreenIcon theApp = new HomeScreenIcon(true);
theApp.enterEventDispatcher();
}
}
public HomeScreenIcon(boolean autoStart)
{
if (autoStart)
{
//The application started using the auto start entry point.
//Setup the rollover icons.
final Bitmap regIcon = Bitmap.getBitmapResource("1.png");
final Bitmap icon = Bitmap.getBitmapResource("2.png");

invokeLater(new Runnable()
{
public void run()
{
ApplicationManager myApp =
ApplicationManager.getApplicationManager();
boolean keepGoing = true;

while (keepGoing)
{
//Check if the BlackBerry has completed its startup process.
if (myApp.inStartup())
{
//The BlackBerry is still starting up, sleep for 1 second.
try
{
Thread.sleep(1000);
}
catch (Exception ex)
{
//Couldn't sleep, handle exception.
}
}
else
{
//The BlackBerry has finished its startup process.
//Set the rollover icons.
HomeScreen.updateIcon(regIcon, 0);
HomeScreen.setRolloverIcon(icon, 0);
keepGoing = false;
}
}
//Exit the application.
System.exit(0);
}
});

}
else
{
//The application was started by the user.
//Start the application and display a GUI.
MainScreen ms = new MainScreen();
ms.setTitle(new LabelField("Hello there."));
pushScreen(ms);
}
}
}

 

 

 

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Component Pack 4.7 - rollover icon doesn't change

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Component Pack 4.7 - rollover icon doesn't change

calling thread.sleep in an invokelater block is a bit questionable if you ask me.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 2
Registered: ‎02-10-2009
My Device: Not Specified

Re: Component Pack 4.7 - rollover icon doesn't change

tbilisoft,

 

Thank you for the help. I had tried some of the examples from the KB articles before, but it never worked.  I suspect it was the "invokelater()" method that made the real difference.

 

The fact that I am a "newbie" means that some of the more obvious things, trip me up.

 

One of the articles I came across suggested that Component Pack 4.7 didn't require the additional code and entry point approach, so I followed those instructions.  I didn't understand that the Bold didn't support 4.7 (I figured it was new, why wouldn't it).

 

Anyway, thanks for the help!

Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: Component Pack 4.7 - rollover icon doesn't change

JDE version, Component pack version, device OS version - all of them show version of RIM API used.

 

If you compile your application with RIM API version 4.7 it will run only on Blackberry Storm devices, because only these devices for now have device OS version 4.7

 

Bold has device OS 4.6 and application compiled with RIM API 4.7 won't run on Bold devices.

New Developer
Posts: 24
Registered: ‎05-14-2009
My Device: Not Specified

Re: Component Pack 4.7 - rollover icon doesn't change

Hi,

       i am using eJDE 4.6 .  I got  two problem

1) when i rollover the icon , the icon doesnt change for the first time , untill i click Once on image . After clicking,  u move to other icon and   come back the rollover works perfect. 

2) when i click on rollover image, my project is not working !!!. My apps is not opened .. No Error message !!

 

Can anyboby Help me !!

 

Thanks

Sudhakar