public class RolloverIconApp extends UiApplication
{
public RolloverIconApp(boolean autoStart)
{
if (autoStart)
{
// If the application started using the auto start
// entry point, we setup the our icons.
final Bitmap regularIcon = Bitmap.getBitmapResource("unfocused_icon.png");
final Bitmap rolloverIcon = Bitmap.getBitmapResource("rollover_icon.png");
invokeLater(new Runnable()
{
public void run()
{
ApplicationManager myApp =
ApplicationManager.getApplicationManager();
boolean inStartup = true;
while (inStartup)
{
if (myApp.inStartup())
{
// Wait for the device to finish the startup process.
try
{
Thread.sleep(1000);
}
catch (Exception ex)
{
// TODO: handle exception.
}
}
else
{
HomeScreen.updateIcon(regularIcon, 0);
HomeScreen.setRolloverIcon(rolloverIcon, 0);
inStartup = false;
}
}
// We're done setting up the icons. Exit the app.
System.exit(0);
}
});
}
else
{
// The application was started by the user, display the UI.
MainScreen ms = new MainScreen();
ms.setTitle("Did you see the rollover icon?");
pushScreen(ms);
}
}
public static void main(String[] args)
{
RolloverIconApp theApp;
//Check for the argument defined in the project properties.
if (args != null && args.length > 0 && args[0].equals("autostart"))
{
theApp = new RolloverIconApp(true);
}
else
{
theApp = new RolloverIconApp(false);
}
theApp.enterEventDispatcher();
}
}