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.

Choice field: date picker

Use a date picker to permit BlackBerry device users to select a date and time.

Class

DateTimePicker

Supported since

BlackBerry Java SDK 5.0

More information

For more information about date and time pickers, see the UI Guidelines.

Example

This screen shows a date picker.

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.picker.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.database.*;
import net.rim.device.api.io.*;
import java.util.*;

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

class DatePickerDemoScreen extends MainScreen
{
    public DatePickerDemoScreen()
    {
        setTitle("Date picker demo");
        add(new RichTextField("Trying Date Picker"));
        
        UiApplication.getUiApplication().invokeLater(new Runnable()
        {
            public void run()
            {
                DateTimePicker datePicker = DateTimePicker.createInstance();
                datePicker.doModal();
            }
        });
    }
}