Indicate activity
You can display a field in your BlackBerry® device application that indicates that work is proceeding. Typically, the field is a spinner, an hour glass, or other similar animated visual cue. The field is implemented by using the ActivityImageField class.
Code sample
public class ActivityIndicatorScreen extends MainScreen
{
ActivityIndicatorView view = new ActivityIndicatorView(Field.USE_ALL_WIDTH);
ActivityIndicatorModel model = new ActivityIndicatorModel();
ActivityIndicatorController controller = new ActivityIndicatorController();
public ActivityIndicatorScreen ()
{
setTitle("Activity Indicator Demo");
view.setController(controller);
view.setModel(model);
controller.setModel(model);
controller.setView(view);
model.setController(controller);
// Define the indicator image and create a field from it
Bitmap bitmap = Bitmap.getBitmapResource("spinner.png");
view.createActivityImageField(bitmap, 5, Field.FIELD_HCENTER);
// add the view to the screen
add(view);
MenuItem _stopIndicator = new MenuItem("Stop spinner", 66000, 0)
{
public void run()
{
view.getModel().cancel();
}
};
MenuItem _resumeIndicator = new MenuItem("Resume spinner", 66010, 0)
{
public void run()
{
view.getModel().resume();
}
};
addMenuItem(_stopIndicator);
addMenuItem(_resumeIndicator);
}
}
The Progress Indicator Demo sample application that is included in the BlackBerry® Java® SDK creates and manipulates a variey of activity indicators, including the spinner that is shown above.
Next topic: Indicate progress
Previous topic: Indicating activity or task progress