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

Have Your Application Perform an Action after a Global Alert

by BlackBerry Development Advisor ‎02-17-2010 09:57 AM - edited ‎09-16-2010 02:47 PM (2,758 Views)

Summary

 

This article applies to the following:

  • BlackBerry® Device Software 4.0 and later
  • BlackBerry Java™ Development Environment (JDE) 4.0 and later

Description

 

Many native BlackBerry device applications, such as the Calendar application, use global dialog boxes to alert the BlackBerry device user of an event (e.g., reminder for a meeting appointment). After the notification, it sometimes makes sense for the application that triggers the alert to either come to the foreground or take some action. There are a couple of ways to accomplish this goal.

 

The first way to have your application become active from a global dialog box is to implement a class that extends the dialog box to either override the onClose() method, or use the button functionality as the trigger (this implementation is similar to the BlackBerry device user choosing to view the calendar appointment when he or she receives the reminder).

 

Alternatively, your application could implement a DialogClosedListener and attach it to the dialog box being displayed. Assuming an implementation of the DialogClosedListener called MyListener, below is a sample showing how to set up the global dialog box:

 

 

Dialog myDialog = new Dialog(Dialog.D_OK, "Hello", Dialog.D_OK, null, 0);
myDialog.setDialogClosedListener(new MyListener());
UiApplication.getUiApplication().pushGlobalScreen(myDialog, 1, true);

 

Contributors
Users Online
Currently online: 26 members 807 guests
Please welcome our newest community members: