Saturday, March 21, 2009

Code : Change HomeScreen-Icon on an external event

Code Code:

String[] newargs = {"homescreen"};
int modHandle = CodeModuleManager
    .getModuleHandle("HomeScreenIconTest");
ApplicationDescriptor[] apDes =
    CodeModuleManager.getApplicationDescriptors(modHandle);
ApplicationDescriptor apDes2 = new
    ApplicationDescriptor(apDes[0], newargs);
ApplicationManager.getApplicationManager()
    .runApplication(apDes2);

and the main from the Class HomeScreenIconTest:

Code:

public static void main(String[] args) {
    if (args.length > 0 && args[0].equals("homescreen")) {
        HomeScreen.updateIcon(CROSS,0);
        HomeScreen.setRolloverIcon(MAN,0);
    } else {
        HomeScreenTest theApp = new HomeScreenTest();
        theApp.enterEventDispatcher();
    }
}

If event listener (running as a system service) registers
an event then now update the icon of main application,
indicating that there is an event waiting.
Maybe draw a number with graphics on the Bitmap.

No comments:

Post a Comment

Place your comments here...