Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Activity field: activity indicator

Use an activity indicator to display a visual cue that a task whose duration is unknown is progressing. If you can calculate how long the task will take, consider using a progress indicator instead.

Class

ActivityImageField

Supported since

BlackBerry Java SDK 6.0

More information

For more information about activity indicators, see the UI Guidelines.

Example

This screen shows an activity indicator.

import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.progressindicator.*;
import net.rim.device.api.ui.container.*;

public class ActivityIndicatorDemo extends UiApplication 
{
    public static void main(String[] args)
    {
        ActivityIndicatorDemo theApp = new ActivityIndicatorDemo(); 
        theApp.enterEventDispatcher(); 
    }
    
    public ActivityIndicatorDemo() 
    { 
        pushScreen(new ActivityIndicatorDemoScreen()); 
    } 
}

class ActivityIndicatorDemoScreen extends MainScreen
{
    ActivityIndicatorView view = new ActivityIndicatorView(Field.USE_ALL_WIDTH);
    ActivityIndicatorModel model = new ActivityIndicatorModel();
    ActivityIndicatorController controller = new ActivityIndicatorController();

    public ActivityIndicatorDemoScreen ()
    {
        setTitle("Activity Indicator Demo");
        
        view.setController(controller);
        view.setModel(model);

        controller.setModel(model);
        controller.setView(view);

        model.setController(controller);        

        Bitmap bitmap = Bitmap.getBitmapResource("spinner.png");
        view.createActivityImageField(bitmap, 5, Field.FIELD_HCENTER);
        
        add(view);
    }
}