Click one of the following tabs

Summary The Summary view displays general statistics about the system and the garbage collection process. It displays the percentage of time that the JVM spends idle, executing code, and performing quick and full garbage collection processes. The Percent column displays the percent of total JVM running time, including idle and collection times. Methods The Methods view displays a list of modules, sorted either by the information that you are profiling or by the number of times that the...

Making Secure HTTP HTTPS Connections

To make a connection to a secure HTTP server, replace http with https in the Connector.open method. Fortunately, the web application also supports HTTPS connections, so simply substitute https into the URL to make and then click Get. The result will look almost the same as the non-secure HTTP connection see Figure 7-14 . Figure 7-14. Retrieving the web application over HTTPS Figure 7-14. Retrieving the web application over HTTPS Performing the POST works in a similar way. We haven't had to...

Hello BlackBerry

In this section, you'll see the basics of how RIMlets work by creating a Hello World'' RIMlet. Note The term RIMlet is an informal name that you'll see in discussions on the Internet, but it doesn't appear in RIM's official documentation. As you'll see in the sections on compiling and building your application, RIM uses the term CLDC application for BlackBerry applications that aren't MIDlets. This choice of terminology is confusing because a MIDlet is also a type of CLDC application. Since...

Code sample Creating an encrypted SQLite database

Research In Motion Limited proprietary and confidential Copyright Research In Motion Limited, 2009 import net.rim.device.api.ui. 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. public class CreateEncryptedDatabase extends UiApplication public static void main String args CreateEncryptedDatabase theApp new CreateEncryptedDatabase theApp.enterEventDispatcherQ pushScreen new...

Creating the Domain Field and Check Box

The Domain field should be a drop-down list. For the BlackBerry, this is accomplished by an instance of You can implement the interface directly, but for this application, the net.rim.device.api.ui.component. ObjectChoiceField component will do just fine it allows us to specify an array of Objects, which will be used to populate the field the toString method will be used for the display string . If you want a list of numbers, net.rim.device.api.ui.component. NumericChoiceField is also often...

Listen to Me

The five states give a big picture of what your media is doing, but sometimes you'll want more granularity than that. It might be nice to know when you have recorded 30 seconds of audio, or when a stream has run out of data and needs to buffer. RIM supports these use cases by offering a standard listener interface. By implementing PlayerListener, your application can register with a Player instance, as shown in Figure 2-3. PlayerListener defines a single method, playerUpdate , which will be...

MIDlet application descriptor properties

Application descriptor files have an extension of .jad. A standard MIDlet .jad file contains the following predefined attributes, and might contain additional attributes defined by the application. URL from which the .jar file can be loaded organization that provides the MIDlet suite version of the MIDlet suite, formatted as minimum number of bytes of persistent data required by the MIDlet suite the default is zero text message that appears when prompting the user to confirm deletion of the...

Manage foreground events

The system calls Application.activate when it brings an application to the foreground. Most applications do not need to override activate . Applications should perform any initialization, including any required UiApplication.pushScreen calls, in the application constructor. Because activate can be called multiple times for the same application, applications should not perform a one-time initialization in this method. An application can override activate to perform additional processing when it...

Delegate Managers

A screen doesn't directly lay out any of its fields. Instead, it delegates that to a manager that's specified when the screen is instantiated. All the manager methods on the screen add, delete, insert, etc. actually end up invoking the same methods on the delegate manager. The only component the screen handles directly is the delegate manager. This separation of manager and screen makes it easy to change the internal layout of any screen. This also means that a screen must have a delegate...

HTTP support parameters

This parameter turns on TRUE or turns off FALSE HTTP standard logging HTTP headers only . This parameter turns on TRUE or turns off FALSE HTTP debug logging HTTP data and headers . This parameter should be set to TRUE only when necessary to debug a specific problem. This parameter turns on TRUE or turns off FALSE cookie storage. If you select TRUE, BlackBerry MDS Services manages cookie storage instead of the BlackBerry device. This reduces the load on the BlackBerry device significantly....

Run on the event dispatch thread

If holding the event lock is not appropriate, create a class that implements the Runnable interface. Invoke its run method on the event dispatch thread by invoking one of the following three methods Invoke invokeAndWait Runnable to have run called on the event dispatch thread immediately. The call blocks until run completes. Invoke invokeLater Runnable to have run called on the event dispatch thread after all pending events are processed. Invoke invokeLater Runnable, long, boolean to have run...

Display stack

Screen objects are maintained in a display stack, an ordered set of Screen objects. The screen at the top of the stack is the active screen that appears to the user. When an application displays a screen, it pushes the screen to the top of the stack. When an application closes a screen, it pops the screen off the stack and displays the next screen on the stack, redrawing it as necessary. ONote Each screen can appear only once in the display stack. The VM throws a runtime exception if the same...

Overview

The BlackBerry Theme Studio is a free suite of graphic design tools for designers, developers and anyone with an interest in creating graphics and themes for the BlackBerry device. You can create interactive themes, mobile web sites, splash screens, graphics, and animated content that is optimized for use on BlackBerry devices. The BlackBerry Theme Studio includes the BlackBerry Theme Builder and BlackBerry Composer. With the BlackBerry Theme Builder, you can personalize the look of the screens...

On the General tab set the following options

The profiler tool calculates the time spent executing bytecode in a method and all methods that the method invokes. The profiler tool calculates the time spent executing bytecode in that method only. The timer stops when a call is made to another method. The profiler tool sorts methods in the profile pane by the number of times the application executed the item. Profiled data select in What to profile The profiler tool sorts methods in the profile pane by the data you choose to profile. The...

BlackBerry Development

Learn how to build Java-based BlackBerry applications from scratch All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 electronic 978-1-4302-2428-0 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in...

BlackBerry Theme Builder feature support

When you use the BlackBerry Theme Builder to create themes, you might encounter version compatibility issues when you export your theme to a BlackBerry device. The BlackBerry device might be running a version of the BlackBerry Device Software that does not support the features that are available in the version of the BlackBerry Theme Builder that you use to create the theme. You can use the following table to help verify the features that different versions of the BlackBerry Theme Builder and...

Recording Audio

By now you should have a general idea of how the recording process works. You will request a Player, configure it for your desired capture, start it to begin recording, and then stop it once the recording is complete. At that point you can retrieve the recorded audio data. Before you start, though, you should ask yourself whether you care what format that data will be in. RIM offers several choices for audio encoding. Your choices are described in Table 2-3. Note that each choice has a required...

The ALX File

Desktop installation requires a different type of descriptor file than OTA installation. For desktop installation, the file is XML based and has the extension .alx. Here's an example ALX file for UiFun lt loader version 1.0 gt lt application id UiFun gt lt name gt The Beginning BlackBerry UI Fun Application lt description gt lt version gt 1.0.1 lt version gt lt vendor gt Anthony Rizk lt vendor gt lt copyright gt Copyright c 2009 Anthony Rizk lt copyright gt lt fileset Java 1.39 gt lt directory...

App Localized Text

MediaGrabber's simple UI can be run on a wide variety of devices without requiring changes to the code. By using the CLDC UI framework, the same code works fine on touch-screen and QWERTY devices. Throughout the book, I have been careful to test for feature support within the app, so no extra work is required to support the presence or absence of a camera or other piece of hardware. MediaGrabber does make use of APIs from version 4.5, but none from later OS versions. It seems reasonable to...

Protecting a StandAlone BlackBerry

Out of the box, most devices aren't configured securely. As you learned earlier, the default firewall options are not set as securely as they could be and the firewall is disabled by default. The same is true with other settings that enable a user to gain physical access to the device. Securing the standalone BlackBerry includes the following steps Protect against unauthorized access to the device. Implement content protection. These are important steps to understand the next two sections cover...

Uninstalling using your BtackBerry handheld

When you're on the run and don't have access to your PC, you can still unin-stall an application from your BlackBerry handheld. Follow these steps to uninstall BlackBerry Blogger or an application of your choice from your BlackBerry handheld 1. Highlight the Options Settings application from the BlackBerry Home screen and press the trackwheel. Doing so opens the Options Settings application. 2. Scroll through the list of options until you find the Applications setting and then press the...

Implementing the Login and Clear Menu Items

We'll implement two menu items for our application corresponding to the Login and Clear actions. We'll create a new class for each menu item and declare these as inner classes within UiFunMainScreen because we'll only use them here and to give them access to UiFunMainScreen's private login and clearTextFields methods public class UiFunMainScreen extends MainScreen implements FieldChangeListener class LoginMenuItem extends MenuItem public LoginMenuItem super Login, 20, 10 class ClearMenuItem...

Animating the Layout

protected void sublayout int width, int height super.sublayout width, height if verticalOffset gt 0 if animationStart 0 start the animation animationStart System.currentTimeMillis long timeElapsed System.currentTimeMillis - animationStart if timeElapsed gt animationTime verticalOffset 0 float percentDone float timeElapsed float animationTime verticalOffset Display.getHeight - int percentDone Display.getHeight Runnable public void run updateLayout Notice that there's an initial case where...

InstallShield WizardBlackBerry Enterprise Server Management MAPI Profile screen

15. In the Management MAPI Profile field, type the name of the MAPI profile for the BlackBerry Enterprise Server Management administration service account, which the BlackBerry Enterprise Server Management service uses to communicate with the Microsoft Exchange Server. a Note The service account name can be the same as or different from the MAPI profile and service account that you use for the BlackBerry Enterprise Server. You can change the default MAPI profile name to match that of another...

Connection Method Using Direct TCPIP Instead of BESMDS

Now, let's take a few minutes to see how to force a connection to make a direct TCP IP connection to the server instead of using the BES MDS. The Networking application currently uses the device's default connection method. As mentioned earlier, if you run the application on a device that's not activated on a BES, the requests will already go over direct TCP IP. However, if you run on a device connected to a BES, the POST and GET requests are done through the BES. To force them to go directly,...

Understanding BlackBerry Application Files

Once you build your project using one of the build options under the project menu , the BlackBerry build tools will create a series of files. Some of these files are standard MIDP files, and some are BlackBerry specific. The JARfile extension .jar is the main application file for MIDP. It's the file containing the resources and compiled class files to run on the device. It's a standard Java Archive file with the added requirement that the manifest file META-INF MANIFEST.MF in the JAR file has...

Code sample Creating custom buttons

Copyright C 2001-2005 Research In Motion Limited. All rights reserved. package com.rim.samples.docs.custombuttons import net.rim.device.api.ui. import net.rim.device.api.system. CustomButtonField is a class that creates button fields of various shapes. This sample demonstrates how to create custom UI fields. public class CustomButtonField extends Field implements DrawStyle public static final int RECTANGLE 1 public static final int TRIANGLE 2 public static final int OCTAGON 3 Constructs a...

Creating a Custom Screen

We're actually using three screens in our UI Fun application already. Two are obvious UiFunMainScreen and the login success screen. The third is the dialog that appears when you try to log in without entering a username and password see Figure 5-24 . Figure 5-24. The login dialog is a Screen too Figure 5-24. The login dialog is a Screen too A screen on the BlackBerry doesn't have to take up the entire display other screens can be visible below it. All screens, however, do take over the user...

Intercepting BlackBerry Communication

Most BlackBerrys come equipped with a 3G mobile-data wireless-connectivity interface, such as EvDO. In addition, most have Bluetooth capability and some even have Wi-Fi capability. It is important to realize that these interfaces are actually transmitting data to and from the BlackBerry device. This data could be sensitive and needs to be protected. Not all of these interfaces transmit data in a linear fashion. The data does not go directly from point A to point B. Rather, the data is like a...

Organize fields horizontally

HorizontalFieldManager organizes fields horizontally. To enable horizontal scrolling, provide the Manager.horizontal_scroll style. If you do not include the horizontal_scroll parameter, the fields arrange themselves horizontally and can exceed the width of the screen, but users cannot scroll to content that is beyond the right side of the screen. BlackBerry devices do not display horizontal scrolling indicators or scroll bars. HorizontalFieldManager hfm new

Tidying Up the Login Success Screen

Now that we've got a few components, let's revisit LoginSuccessScreen. With some simple modifications to the constructor to use our CustomLabelField and GridFieldManager, we can make the screen look a little better. public LoginSuccessScreen String username, String domain try FontFamily alphaSansFamily FontFamily.forName BBAlpha Serif Font appFont alphaSansFamily.getFont Font.PLAIN, 9, Ui.UNITS_pt setFont appFont catch ClassNotFoundException e add new CustomLabelField Logged In , Color.WHITE,...

Content element

The content element declares the start file used by the BlackBerry Widget when it runs. If you do not specify a content element, a default start file from within the widget archive is used. The start file can also be a URL to a remote file outside of the BlackBerry Widget archive. The src attribute specifies the source HTML file within the widget archive. This attribute is required. The type attribute specifies the MIME type for the file referenced in the src attribute. This attribute is...

Build Script

Even if you don't have GNU make or Apache Ant installed, you can whip together a quick and dirty build script using Notepad or another basic text editing program. Use the build script in Listing 11-2 to generate a new application without requiring Eclipse to be open. You can modify the variables at the top of the script with the location of your BlackBerry component package, signing password, and so on. set FILES MediaGrabber.java ChoicesScreen.java PlayingScreen.java RecordingScreen.java...

Create custom context menus

Create the custom context menu gt In your field class, create the custom context menu items. items. private Menultem myContextMenultemA new MenuItem _resources, MENUITEM_ONE, 200000, 10 public void run private MenuItem myContextMenuItemB new MenuItem _resources, MENUITEM_ONE, 200000, 10 public void run Provide a context menu. gt In your main application class, override makeContextMenu . protected void makeContextMenu ContextMenu contextMenu Create the application menu. gt In your main...

Avoid using StringBufferappendStringBuffer

CLDC does not include a StringBuffer.append StringBuffer method. Appending a string buffer to another in this way creates an intermediate String object. Instead, applications should use StringBuffer dst, StringBuffer src , int offset, int length . public synchronized StringBuffer append Object obj return append String.valueOf obj public synchronized StringBuffer append Object obj if obj instanceof StringBuffer StringBuffer sb StringBuffer obj this, sb, 0, sb return this

Event listeners

Event listener interfaces are divided by event type. Each application registers to receive specific types of events. The application event queue then dispatches events to the appropriate listeners. Applications can implement the appropriate listener interfaces or override the listener methods on the various Screen objects. Most applications implement the KeyListener and TrackwheelListener interfaces and register the listeners to receive keyboard and trackwheel events. The keyboard and...

Create a custom field

Create a custom field. You can only add custom context menu items and custom layouts to a custom field. gt Extend the Field class, or one of its subclasses, implementing the DrawStyle interface to specify the characteristics of the custom field and turn on drawing styles. public class CustomButtonField extends Field implements DrawStyle public static final int RECTANGLE 1 public static final int TRIANGLE 2 public static final int OCTAGON 3 private String _label private int _shape private Font...

Invoking the RIM Alternative

Oldest Blackberry

As discussed earlier, sometimes you may want to launch a native RIM application to handle media capture instead of using MMAPI. Some times this will be your only choice, such as if you need to take a picture on a device without software version 4.6 or take a video on a device without version 5.0. Even if your device supports your desired operation, you may prefer the interface of the native application to what you can provide on your own. Starting recording in this manner is much simpler than...

Use encoded images

The net.rim.device.api.system.EncodedImage class encapsulates encoded images of various formats. The BlackBerry device supports the following image formats .gif, .png, .wbmp, and .jpeg. Only BlackBerry devices with color screens support .jpeg images. Note The JPEGEncodedImage class requires a signature that is not available. Use EncodedImage subclasses, PNGEncodedImage and WBMPEncodedImage, to access specific properties of .png and .wbmp images, respectively. For example, PNGEncodedImage...

Making the Button Focusable

To make the button focusable we'll just override isFocusable in CustomButtonField to return true public boolean isFocusable return true Now, you'll be able to move the focus down to the buttons, but the visual representation shown in Figure 5-10 is not what we want. Figure 5-10. Custom button fields with the default focus drawing behavior Figure 5-10. Custom button fields with the default focus drawing behavior

RIM Push request response codes

Access control error or unknown email address or BlackBerry PIN specified. The server received the request, but is unable to respond. At the present time, the server is not able to manage the request due to temporary overloading or server maintenance.

Bluetooth Troubleshooting

Bluetooth is still an emergent technology and, sometimes, it doesn't work as well as we might hope. If you are having difficulty, perhaps one of these suggestions will help. 1. My Pass key is not being accepted by the device a. It is possible that you have the incorrect pass key. Most Bluetooth devices use either 0000 or 1234 -but some have unique pass keys. b. If you lost your manual for the Bluetooth device, many times you can use a web search engine such as Google or Yahoo to find the...

Perform one of the following tasks Scw

Load an application .cod file on the BlackBerry Issue a command using the following format javaloader -u load lt .cod file gt For example javaloader.exe -u load MyApplication.cod JavaLoader loads the .cod files listed in the .jad file on the BlackBerry device and stores the .cod files in a CodeModuleGroup. Load application .cod files listed in the same .jad Issue a command using the following format javaloader -u load lt .jad file gt For example javaloader.exe -u load MyApplication.jad...

Location Documents

BlackBerry Maps defines an XML document format that you can use to specify view information, location markers, and route information while invoking BlackBerry maps. The basic format of a document showing one or more locations is lt location y 'latitude' x 'longitude' label 'Location_Label' description 'Description' gt lt location y 'latitude' x 'longitude' label 'Location_Label' description 'Description' gt lt location y 'latitude' x 'longitude' label 'Location_Label' description 'Description'...

A Quick Introduction to USB

USB Universal Serial Bus communication is carried out between a host and its devices. Usually the host is a PC or laptop, and devices their peripherals, such as printers, hard drives, and keyboards. The host detects devices, manages data flow on the communications bus, carries out error checking, and often provides power to the devices. In this chapter, the host is the PC running the BaseStation application, and the device is the Dream Cheeky garage and car. A device is uniquely identified by...

BlackBerry application descriptor properties

In addition to the MIDlet application properties, the following attributes apply to BlackBerry application .jad files. list of modules that the .cod file requires name of the module contained in the .cod file URL from which the .cod file can be loaded name of the resource bundle that the application depends on suggested position of the application icon on the Home screen Note This position might not be the actual position of the application icon on the Home screen. The BlackBerry JDE enables...

About cell broadcast messages

If your service provider supports cell broadcasting and provides you with access to a cell broadcasting channel, you can receive broadcast messages from the wireless network. These SMS messages can communicate information about weather, sports, traffic, or other news directly to your device. Contact your service provider for more information about cell broadcasting. The cell broadcast channels that you subscribe to determine the kind of cell broadcast messages that you receive. Contact your...

Handling the Clear Button

We'll hook up the Clear button first. Add the following line in the constructor, just after instantiating the button Now, when the user clicks on the clear button, we'll receive an event in UiFunMainScreen.fieldChanged. We can test this with a simple dialog using the net.rim.device.api.ui.component.Dialog class public void fieldChanged Field field, int context if field clearButton Dialog.inform Clear Button Pressed The Dialog class is a handy way of displaying simple messages to the user. Run...

From Mercator to Image Coordinates

Mercator Projection

Google maps use a Mercator cylindrical projection to flatten the earth's surface onto a 2D map, as illustrated by Figure 11-12. Longitudes are mapped linearly to the x-axis, but latitudes are increasingly spaced out the further they are from the equator. This increasing distortion means that Google Maps only utilizes the Mercator projection between latitudes 85.05113 degrees north and south, which explains why some parts of the polar regions are missing in Figures 11-8 and 11-12. Figure 11-12....

Embedding JavaScript in a Markup Document

JavaScript scripting is supported in XHTML-MP 1.1 and 1.2 using the same markup syntax as XHTML. Mobile Web documents containing scripting must use a doctype for the appropriate XHTML-MP version to ensure that the markup is valid. Here are the doctypes used for XHTML-MP 1.1 and 1.2, respectively. lt DOCTYPE html PUBLIC - WAPFORUM DTD XHTML Mobile 1.1 EN lt DOCTYPE html PUBLIC - WAPFORUM DTD XHTML Mobile 1.2 EN Chapter 3 contains more detailed information about doctypes and XHTML-MP versions. In...