Changes

Jump to: navigation, search

BlackBerry : Develop Simple Apps

14,147 bytes added, 21:21, 26 February 2011
no edit summary
{{Ecl_activities|type=BlackBerry|type-repo=mobile-blackberry}} __NOTOC__
== Understanding the Java Application files ==
 
In order to build BlackBerry applications on Eclipse, one must understand the basic files and their roles:
 
* '''''alx''' Files''
 
The .alx file is the application descriptor that provides information about the application and the location of the application's .cod files.BB Eclipse plug-in automatically generates the file.
 
Example:
 
<source lang="xml">
 
<loader version="1.0">
<application id="BBLab">
<name >
</name>
<description >
</description>
<version > 0.0.1 </version>
<vendor > ECL500 Course </vendor>
<copyright >
Copyright (c) 2011
</copyright>
<fileset Java="1.52" _blackberryVersion="[6.0.0)">
<directory >
6.0.0
</directory>
<files >
BBLab.cod
</files>
</fileset>
</application>
</loader>
</source>
------
 
* '''.cod ''' Files''
 
A .cod file contains compiled and packaged application code.
The standalone application loader tool requires these files to install the BlackBerry Java Application.
The file is similar with a jar file, but has a proprietary format.
 
--------------
 
* '''''.jad''' Files''
 
When deploying BlackBerry applications to a device the BlackBerry Application Web Loader, BlackBerry browser, and BlackBerry App World use the .jad file, that is a simple text file. It contains information needed to verify the application files during the deployment process.
<source lang="xml">
Manifest-Version: 1.0
RIM-COD-Module-Name: BBLab
RIM-COD-Module-Dependencies: net_rim_cldc
MIDlet-Jar-Size: 12403
MIDlet-1: ,img/cs_logo.png,
RIM-COD-Creation-Time: 1298760710
MIDlet-Jar-URL: BBLab.jar
RIM-COD-URL: BBLab.cod
RIM-COD-SHA1: 73 cd f1 b7 b0 35 0c c3 a6 a5 42 53 5e 83 a1 e7 4c 02 7e d2
RIM-COD-Size: 6404
MicroEdition-Configuration: CLDC-1.1
MIDlet-Version: 0.0.1
MIDlet-Name: BBLab
MIDlet-Vendor: Vendor
MicroEdition-Profile: MIDP-2.0
RIM-MIDlet-Flags-1: 0
</source>
-------------
== Read Code from the BlackBerry Samples ==
[http://docs.blackberry.com/en/developers/subcategories/?userType=21&category=Sample+Applications Here are some of the most important BlackBerry Samples]''The content from BlackBerry developer site has been used for these notes for which a grateful acknowledgment is made.'' ---------------------------
=== Active Text Fields ===
-------------
 
=== Bitmap Scaling ===
The sample application demostrates how to scale an original Bitmap image into new Bitmap objects, how to apply filters that help reduce the pixelated appearance of a scaled Bitmap image, and how to preserve the aspect ratio of the image.
---------------
 
=== Custom Buttons ===
[http://docs.blackberry.com/en/developers/deliverables/7721/Custom_buttons_sample_app_overview_546026_11.jsp Overview]
 
'''The custom buttons sample application demonstrates how to extend the Field class to create a variety of different button UI components.'''
 
The sample application demonstrates how to create the following types of buttons:
* rectangle
* triangle
* octagon
* rectangle with a fixed width
* rectangle with a fixed width and a long text label
* rectangle with a full screen width
* rectangle with a color background
* rectangle with a .bmp image as the background
 
In addition to creating and displaying these custom buttons, the sample application also demonstrates how to attach listeners to these custom buttons. Listeners are components that execute code when an event occurs. In the sample application, when you click one of these buttons, a dialog box appears with text specifying which of the buttons you clicked.
----------------------
 
=== Decor ===
[http://docs.blackberry.com/en/developers/deliverables/9076/Decor_sample_app_overview_672047_11.jsp Overview]
 
'''The decor sample application demonstrates how to create custom fields by specifying their border, padding, color, and background attributes.'''
 
You can use the sample application to create fields that have the following attributes:
 
* solid rounded border with a solid background
* dotted rounded border with a transparent background
* dashed simple border with a gradient background
* dotted simple border with no padding
* beveled border with an image as a background
-------------------
 
=== Eyelid Field Manager ===
[http://docs.blackberry.com/en/developers/deliverables/23108/EyelidField_sample_app_overview_856064_11.jsp Overview]
 
'''The eyelid field sample application demonstrates how to use the EyelidFieldManager class to display fields on a pair of managers that appear temporarily at the top and bottom of the screen.'''
 
When a BlackBerry® device user moves the trackpad or trackball, or when the user touches the screen (on aBlackBerry device with a touch screen), the managers are displayed temporarily on the top and bottom of the screen. While the managers are visible, the user can interact with the fields that appear on each manager. The user can also control the appearance of the managers by selecting or clearing check boxes that appear in the center of the screen.
 
For more information about displaying fields and managers in a BlackBerry device application, see the UI and Navigation Development Guide.
------------------
 
=== File Picker ===
[http://docs.blackberry.com/en/developers/deliverables/13279/FilePicker_sample_app_overview_944376_11.jsp Overview]
 
'''The file picker sample application demonstrates how to create a UI component that presents a list of folders and files from which a user can select a file'''. The sample application also demonstrates how to specify the default search location for folders and how to filter files by file extension (for example, how to display only .mp3 files).
--------------------
 
=== GPS ===
[http://docs.blackberry.com/en/developers/deliverables/7701/GPS_sample_overview_509591_11.jsp Overview]
 
'''The GPS sample application implements a travel calculator that tracks the current location (using longitude, latitude, and altitude), direction, grade, and travel speed.'''
 
The GPS sample application uses the LocationProvider API to collect the GPS location information from theBlackBerry® device.
 
The sample application displays the information nearly simultaneously and updates the information at intervals that constants in the application specify.
 
The sample application also stores waypoints in persistent storage. These waypoints are recorded at intervals that constants in the application specify. The waypoints record the date and time they were taken, the distance travelled (using longitude, latitude, and altitude), and the average speed since the last waypoint.
--------------------
 
=== HTTP push ===
[http://docs.blackberry.com/en/developers/deliverables/7649/HTTP_push_sample_app_overview_552691_11.jsp Overview]
 
'''The HTTP push sample application demonstrates how to push content to a BlackBerry® device and how to listen for pushed content on a BlackBerry device.'''
 
The sample application provides both a server-side application that you can use to send content to a BlackBerry Smartphone Simulator or BlackBerry device and a client-side application that listens for pushed content on aBlackBerry device.
-------------------
 
=== Media Keys ===
[http://docs.blackberry.com/en/developers/deliverables/16743/Media_keys_sample_app_overview_818387_11.jsp Overview]
 
'''The Media Keys sample application is a MIDlet that demonstrates how to respond to media key-press events on aBlackBerry® device'''. Media keys control the playback of music, video, and pictures that are stored on the device. The sample application is designed to accept media key presses while running in either the foreground or background.
 
The sample application highlights the use of the MediaBehaviourControl interface, which enables a MIDlet to act as a media player. For more information about monitoring media key-press events using the BlackBerry Java® API, see the Multimedia Development Guide.
-------------------
 
=== Notification ===
[http://docs.blackberry.com/en/developers/deliverables/7671/Notifications_sample_app_overview_601451_11.jsp Overview]
 
'''The notifications sample application demonstrates how to define, start, and stop notification events''' on aBlackBerry® device. Notifications include either hardware-driven notifications (such as a flashing LED light, a vibration, or a tone), software UI driven notifications, (such as a dialog box), or both.
 
The sample application demonstrates how to register the application as a notifications event provider with theBlackBerry® device, how to define what notification events are started when the event occurs, and how to start and stop the notification.
-----------------
 
=== Picture scroll field ===
[http://docs.blackberry.com/en/developers/deliverables/16143/PictureScrollField_sample_app_overview_844624_11.jsp Overview]
 
'''The picture scroll field sample application demonstrates how to create and customize a row of images and how the users can scroll through on their screens'''. You can specify different highlight styles and turn the center lens on and off to demonstrate different configurations of a PictureScrollField object. If you click an image, the sample application displays a simple message.
------------------
 
=== Screen Transitions ===
[http://docs.blackberry.com/en/developers/deliverables/16147/ScreenTransitions_sample_app_overview_956166_11.jsp Overview]
 
'''The screen transitions sample application demonstrates how to create custom transitions between two screens using the TransitionContext class.'''
 
The sample application demonstrates the following animations for transitioning between screens:
* slide
* fade
* wipe
* zoom
-----------------
 
=== Send Media ===
[http://docs.blackberry.com/en/developers/deliverables/7954/Send_media_sample_app_overview_628926_11.jsp Overview]
 
'''The send media sample application demonstrates how to register an application as a content handler for any supported image or video file types''' on the BlackBerry® device.
 
When a user turns on the BlackBerry device, the sample application registers itself as a content handler for the following content types:
 
* image/bmp
* image/png
* video/jpeg
* video/3gpp
* video/mp4
 
When you view a file that is any of the preceding content types in the camera application or video camera application on the BlackBerry device, or if you click a file that is any of the preceding content types in the media application, a menu item, Send to demo app, becomes available. When you click this menu item, the sample application opens the picture or video file.
------------------
 
=== SQLite Database ===
[http://docs.blackberry.com/en/developers/deliverables/9089/SQLite_sample_app_overview_790634_11.jsp Overview]
 
'''The SQLite database sample application demonstrates how to create a persistent relational database that is stored on the BlackBerry® device and how to change the entries in the database.'''
 
The database contains two tables that are called Category and DirectoryItems. The DirectoryItems table contains items that simulate entries in a business directory list. Each DirectoryItem entry also contains aCategoryID field that must match a category_id entry in the Category table (for instance,Category.category_id is a foreign key for DirectoryItem.categoryID).
 
The sample application displays the entries in the tables as a collapsible tree structure with Category entries as parent nodes and DirectoryItem entries as child nodes of the Category nodes that they are associated with. The sample application provides menu items for adding a new category or directory item and for changing or deleting the directory item.
 
This sample application uses APIs that are designed to be secure.'''The application must be signed before it can be run. For more information about code signing''', see the [http://docs.blackberry.com/en/developers/subcategories/?userType=21&category=BlackBerry+Signing+Authority+Tool BlackBerry Signing Authority Tool Administration Guide].
-----------------
 
=== Tilt Demo ===
[http://docs.blackberry.com/en/developers/deliverables/8033/Tilt_sample_app_overview_652847_11.jsp Overview]
 
'''The tilt demo sample application demonstrates how to limit the screen orientations''' that a BlackBerry® device application supports, how to show and hide the keyboard that appears on the screen, and how to implement a custom Field class so that it reacts to changes in the BlackBerry device orientation.
------------------
 
=== Touch ===
[http://docs.blackberry.com/en/developers/deliverables/16179/Touch_sample_app_overview_663486_11.jsp Overview]
 
'''The touch sample application demonstrates how to create and display an image that changes in response to customized touch events'''. If you touch the screen and slide your finger to another location on the screen, the application draws a line to trace the movement. You can click menu items to specify the width and color of the lines and to erase the canvas.
-------------
 
=== Embedded Maps ===
[http://docs.blackberry.com/en/developers/deliverables/12361/Embedded_Maps_sample_app_overview_705016_11.jsp Overview]
 
'''The embedded maps sample application demonstrates how to embed a MapField object in the UI''' of a BlackBerry® application. The LocatorScreen class shows how to use the Locator API to search for locations and display them on the map.
----------
 
=== MapField ===
[http://docs.blackberry.com/en/developers/deliverables/12611/Map_field_sample_app_overview_723736_11.jsp Overview]
 
'''The map field sample application displays a map with all sites of interest'''. The sample application demonstrates how to use the MapField API.
 
Location data is read from a text file and parsed using a string tokenizer class. The data is then used to constructMapFieldDemoSite objects corresponding to RIM® locations around the world. A given site is drawn as a polygon superimposed on the map that is currently displayed.
----------------
 
=== Memory ===
[http://docs.blackberry.com/en/developers/deliverables/10012/Memory_sample_app_overview_693111_11.jsp Overview]
 
'''The memory sample application demonstrates the best practices for memory use for multiple records'''. The sample application uses the Low Memory Manager to deallocate memory containing outdated data and group objects using the ObjectGroup API.
 
The sample application manages data for a fictional business and keeps records for each order that the business places. To see the effects of running the Low Memory Manager without exhausting flash memory, object handles, or persistent object handles, three menu items are provided that execute the same methods as the Low Memory Manager.
----------------

Navigation menu