Utilities
|
Feature
|
Description
|
|
encapsulate functionality and provide it to external clients
by using the Command Framework API
|
You can encapsulate functionality so that it can be reused
across your application and other applications on the device by using the
Command Framework API that is provided in the
net.rim.device.api.command and
net.rim.device.api.command.registrar packages. For example, if your
application has a button and a menu item that perform the same actions, you can
define that common functionality once and reuse it across both UI components.
In previous releases, you had to derive the functionality from each UI
component which resulted in the multiple implementations of the same
functionality.
To use the Command Framework API, create a class that
extends the
CommandHandler abstract class, using the
CommandHandler.execute() method to define
the functionality of the command. Describe the command implemented by the
CommandHandler by using the
CommandMetadata class. You can run the
command by using the
Command class.
You can also create commands that can be used by other
applications on the device by using the classes and interfaces that are
available in the
net.rim.device.api.command.registrar
package. For example, you can register a command by using the
CommandRegistrarConnection interface and
allow other applications to retrieve and execute the command from their
application.
|
|
Scan 1-D and 2-D barcodes
|
You can use the
BarcodeScanner class, located in the
net.rim.device.api.barcodelib package, to
scan a barcode for processing.
To display a viewfinder, use the
BarcodeScanner.getViewfinder() method, to
get an instance of a
Field to add to your screen. To configure
this
Field, use the
VideoControl object returned by
BarcodeScanner.getVideoControl().
To process the scanned barcode, use the
BarcodeDecoderListener class, which is
notified when a barcode has been detected by the
BarcodeScanner.
|
|
Enhancements to the Sensor API
|
The
Sensor class has been updated to include the
ability to determine whether the device has a slider and what state the slider
is in.
- Sensor.isSupported(Sensor.SLIDE)
returns
true if the device contains a slider. If
not, the method returns
false.
- On devices
containing a slider,
Sensor.getState(Sensor.SLIDE) returns
Sensor.STATE_SLIDE_CLOSED,
Sensor.STATE_SLIDE_OPEN, or
Sensor.STATE_SLIDE_IN_TRANSITION.
You can register a listener to be notified of changes to
the slider by implementing the
SensorListener interface and calling
Sensor.addListener().
|
|
Device Capability API
|
You can query the capability of a
BlackBerry device by using the new Device
Capability API that is provided in the
net.rim.device.api.system.capability
package. The
DeviceCapability class allows you to query
whether specific features, such as a virtual keyboard or a physical keyboard,
are supported on the device, whether the feature is currently available to the
user (for example, if the slider on a device is open and the user can use the
physical keyboard), and whether your application can currently access the
feature.
For example,
DeviceCapability.isVirtualKeyboardAvailable()
returns
true if the device has a virtual keyboard
currently displayed. The method returns
false otherwise. You can define a listener
to be notified of changes to specified capabilities of the device by
implementing the
DeviceCapabilityListener interface.
|
|
Detect when a device is connected to a cradle
|
You can now detect when a
BlackBerry device
is connected to a cradle (such as a car kit cradle) by using the new
DeviceCapability.TYPE_CRADLE capability type
that is part of the Device Capability API.
You can use
DeviceCapability.isSupported() and
DeviceCapability.isAvailable() to detect
cradle status. All
BlackBerry
devices running
BlackBerry Device Software version 6.0
return
true for
isSupported(DeviceCapability.TYPE_CRADLE).
When a
BlackBerry device
running
BlackBerry Device Software version 6.0 is
connected to a cradle,
isAvailable(DeviceCapability.TYPE_CRADLE)
returns
true.
When you detect a cradle connection, you can use the new
CradleProtocol class to detect the cradle
type and properties.
CradleProtocol is in the new
net.rim.device.api.accessory package.
|
|
Handle cradles
|
You can now register your application as a cradle handler,
which is an application that is a candidate to be started when a BlackBerry
device is connected to a cradle of a specified type.
To register as a cradle handler, use the
CradleHandlerRegistry.registerHandler()
method.
CradleHandlerRegistry is in the
net.rim.blackberry.api.cradle package. When
you register your application, you specify the type of cradle you want to
handle and your application descriptor.
If any handlers are registered for a cradle type, the device
user will be presented with a selection dialog when such a cradle is connected.
The user can select which handler to use, if any. The selected handler
application will then be started. Also, the selected handler application will
be automatically started the next time the cradle of the specified type is
connected if the user indicated in the selection dialog to take the same action
in the future.
The device user can also change cradle handler settings in
the Third Party Applications section in Options.
|
|
foreign key constraint keep support in the
SQLite API
|
You can use the
DatabaseOptions.set(" foreign_key_constraints",
"on") method to enable foreign key support for your
SQLite
database.
|
|
Graphics Utility API and Math API
|
The Graphics Utility API and Math API are new with
BlackBerry Java SDK 6.0. They designed to simplify OpenGL and OpenVG development on
BlackBerry devices while also
optimizing performance.
The Graphics Utility API and Math API are implemented in the
net.rim.device.api.opengles,
net.rim.device.api.openvg, and
net.rim.device.api.math packages and provide
the following features:
- a new field
class called
GLField that provides built-in support for
OpenGL ES rendering
- a new field
class called
VGField that provides built-in support for
OpenVG rendering
- new methods
added to GLUtils to add functionality for projecting/unprojecting between 2D/3D
spaces and a new method to build 2D mipmap textures
- a new
VGUtils class to support creating an
OpenVG image from a
RIM bitmap,
appending path segments and complex polygons to OpenVG paths, computing complex
2D transformation matrices for applying warps and other special effects to
paths/images and querying OpenVG version information
- new math
classes to support vector math and bounding volume classes to aid in view
frustum culling and intersection testing
|
Was this information helpful? Send us your comments.