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
Example This screen shows a date picker.

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

Code sample: Creating 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();
            }
        });
    }
}
Next topic: File picker
Previous topic: Date field

Was this information helpful? Send us your comments.