New In This Release

Local Navigation

User interface

Send Menu API

You can use the Send Menu API, to add a Send menu item to the menu of your application. A BlackBerry® user can use a Send menu item to send content to another application on the BlackBerry device, such as the Messages application or BlackBerry® Messenger. The content to send is encapsulated as a JSONObject object that is passed from your application to the application that sends the content.

After a BlackBerry device user clicks the Send menu item, the device displays a submenu with a list of applications that can be used to send the content. When the user clicks one of these applications, the selected application starts with certain fields populated with the content to send. The user can complete the remaining fields and send the content. The Send Menu API is located in the net.rim.blackberry.api.sendmenu package.

Back To Top

Command framework enhancements

You can now unregister commands that your application registered previously with the Command framework API by invoking unregisterCommand(), unregisterCommandCategory(), or unregisterModuleCommands(). These methods are provided in the LocalCommandRegistrarConnection class, provided in the net.rim.device.api.command package.

Back To Top

Layering UI elements

You can place UI components on top of other UI components using the ComponentCanvas class. Unlike AbsoluteFieldManager, which provides similar functionality, a ComponentCanvas is drawn on top of other fields and managers on a screen, like a video or camera field. You can add standard UI components, such as labels, buttons, and drop-down lists, to ComponentCanvas. For example, you can use a ComponentCanvas to display a series of buttons on top of a video field or camera field.

ComponentCanvas is found in the net.rim.device.api.ui.container package.

Back To Top

Scanning an image for barcode data

The ZXing 1.6 barcode scanning library is supported in the package. The net.rim.device.api.barcodelib package provides helper classes for barcode scanning.

You can use the BarcodeScanner class to scan and decode 1D- or 2D-barcode data from a frame detected by the camera's viewfinder. When you create a new instance of BarcodeScanner, you pass the constructor an instance of a BarcodeDecoder class and an implementation of the BarcodeDecoderListener or ImageDecoderListener interface. Using decode() (contained in the BarcodeDecoder class) you can parse data into either a byte array or Bitmap object, and perform an action based on that data using barcodeDecoded().

Back To Top

Scanning an image for data

You can use the ImageScanner class to scan and decode data from a frame detected by the camera. When you create a new instance of ImageScanner, you pass the constructor both an implementation of the ImageDecoder interface, and the ImageDecoderListener interface.

The ImageDecoderListener interface provides a method, imageDecoded(), which is invoked when the ImageDecoder is finished parsing the image. These classes are provided in the package

Back To Top

Retrieving the luminance source of a bitmap

You can use the BitmapLuminanceSource and PlanarYUVLuminanceSource classes to create objects that represent the grayscale profile of a bitmap object. You can find these classes in the net.rim.device.api.barcodelib package.

Back To Top

Lightweight Font object

The FontSpec class, provided in the net.rim.device.ui package represents a lightweight Font object containing only basic Font attributes such as font family, size and style. FontSpec is used in OpenVG™ API methods (for example, vgtDrawText()). You can get the FontSpec object representing a Font by using the Font.getFontSpec() method.

Back To Top

Determining supported color quality

You can retrieve the color quality that a BlackBerry® device supports by invoking DeviceCapability.getDisplayColorQuality(), which is provided in the net.rim.device.api.system.capability package. This method returns a TRUE_COLOR constant if the device supports 32-bit color, and returns a HIGH_QUALITY constant otherwise, indicating that a device supports 16-bit color.

Back To Top

Gradient rectangles

You can use the Graphics class in the net.rim.device.api.ui package to draw rectangles with a gradient fill in your application. The gradient fill varies the color within the rectangle based on position, creating a smooth color transition. You can invoke drawGradientFilledRect() to draw a rectangle with a gradient fill with sharp corners, and you can invoke drawGradientFilledRoundedRect() to draw a rectangle with a gradient fill with rounded corners.

Back To Top

32-bit color bitmaps

You can invoke Bitmap.createAlpha() on a Bitmap object to add an alpha transparency channel to the object. When you invoke createAlpha() the method automatically selects the bitmap format.

Back To Top

Retrieving the bitmap type for a given image frame's alpha channel

You can retrieve the bitmap type for the alpha channel of a given frame using the new getAlphaType() method provided by the net.rim.device.api.system.EncodedImage class.

Back To Top

Was this information helpful? Send us your comments.