BlackBerry Java Application
Development
Beginner's Guide
Build and deploy powerful, useful, and professional Java
mobile applicaons for BlackBerry smartphones, the
fast and easy way
Bill Foust
BIRMINGHAM - MUMBAI
Do wnload from Wow! eBook <www.wowebook.com>
BlackBerry Java Application Development
Beginner's Guide
Copyright © 2010 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system,
or transmied in any form or by any means, without the prior wrien permission of the
publisher, except in the case of brief quotaons embedded in crical arcles or reviews.
Every eort has been made in the preparaon of this book to ensure the accuracy of the
informaon presented. However, the informaon contained in this book is sold without
warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers
and distributors will be held liable for any damages caused or alleged to be caused directly or
indirectly by this book.
Packt Publishing has endeavored to provide trademark informaon about all of the
companies and products menoned in this book by the appropriate use of capitals. However,
Packt Publishing cannot guarantee the accuracy of this informaon.
First published: July 2010
Producon Reference: 1190710
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-849690-20-1
www.packtpub.com
Cover Image by Parag Kadam ()
Credits
Author
Bill Foust
Reviewers
Richard Evers
Jason Reese
Acquision Editor
David Barnes
Development Editor
Mehul Shey
Technical Editor
Namita Sahni
Indexer
Monica Ajmera Mehta
Editorial Team Leader
Akshara Aware
Project Team Leader
Priya Mukherji
Project Coordinator
Ashwin Shey
Proofreader
Je Orlo
Producon Coordinators
Alwin Roy
Adline Swetha Jesuthas
Kruthika Bangera
Cover Work
Alwin Roy
About the Author
Bill Foust has been developing soware for over een years in a variety of elds and
technologies. He began working with BlackBerry devices in 1999—before they even had
built-in cellular phones! During that me, he created and sold applicaons, and helped
several companies develop product oerings for BlackBerry.
With the release of the BlackBerry 5810 in 2002, the development environment changed
from C++ to Java Micro and Bill started pursuing other opportunies, including .NET, and has
connued to do development as a consultant professionally since then.
In 2004, he authored the book Mobile Magazine Guide to BlackBerry with Que
Publishing (
/>dp/0789733439
). This book was a success and lead to Bill being a founding member of
the Mobile Compung Authority podcast with two other book authors.
Bill is currently working with a consulng company in Kansas City and connues to opine
about BlackBerry and the mobile compung industry in general through the Mobile
Compung Authority blog and podcasts.
Acknowledgement
First, I need to thank God, the Father, for everything that He has done throughout my life
and for the grace, favor, and peace to get this book done. The opportunity to write this book
came about at a me in my life that was not very convenient. I was looking at moving cross
country and a job change to help take care of my ailing mother. In spite of this, the many
challenges we faced to complete this book were never overwhelming and in the end,
were overcome.
Secondly, I need to thank my wife, Angela, and family for their connual support throughout
the enre process. Even as deadlines were missed and evenings were spent wring instead
of playing with the kids, my wife was understanding and supporve in seeing this done.
I also need to give special thanks to the sta at Packt Publishing for their paence and
understanding with me through all of the issues and delays we faced.
I’d like to dedicate this book to my mother, who passed away during the wring of this
book. We will miss you Mom.
About the Reviewers
Richard Evers develops soware in many languages across several plaorms, and has
extensive experience developing for Oracle, DB2, Informix, MySQL, and SQL Server.
He has been the editor of ve magazines, publisher of two magazines, author of thousands
of soware products, and publisher of eight educaonal websites.
Richard has been helped create books such as the Professional BlackBerry (Wrox), Mobile
PC Guide to BlackBerry (Que), the BlackBerry For Dummies series (Wiley), four BlackBerry
Cercaon Program self-study guides, the Civics Canada Online Textbook, The Complete
Commodore Inner Space Anthology, and The Transactor Book of Bits and Pieces.
Richard worked for Research In Moon for more than 7 years, and recently le RIM to work
for BlueCat Networks as a senior soware engineer.
I would like to thank my wife, Donna, and my children, Stephanie, Samantha,
and Adam, for their love and support through countless years of hiding
behind a computer screen.
Jason Reese has spent 12 years working in the telecommunicaons and wireless industries
managing global mobility projects, device deployments, support, and applicaon development
on all major mobile plaorms. Jason is a regular contributor to the technology site
GearDiary.com. When he’s not working, Jason enjoys traveling and spending me with his
wife, Stephanie, and their 5 year-old Boston Terrier, Sophie.
I would like to thank my wife, Stephanie, who has been incredibly
supporve (and paent!) through many years and projects.
Table of Contents
Preface 1
Chapter 1: Introducing BlackBerry Applicaon Development 7
Expectaons of this book 8
General device capabilies 9
Two dierent approaches to applicaon development 10
Choosing an SDK version 10
What you can expect 12
Summary 14
Chapter 2: Installing the Development Environment 15
System requirements 16
Development Environments 16
Downloading and installing Java 17
Time for acon – downloading the Java Development Kit 17
Time for acon – installing the Java Development Kit (JDK) 20
Introducing the BlackBerry Developer Zone 22
Downloading and installing Eclipse 23
Time for acon – downloading Eclipse with the JDE plugin 24
Time for acon – installing the JDE plugin for Eclipse Full installer 26
Installing other JDE component package versions 28
Time for acon – installing other JDE component packages over-the-air 28
Summary 36
Chapter 3: Geng Familiar with the Development Environment 37
Starng the Eclipse IDE 37
Time for acon – launching Eclipse for the rst me 38
Imporng the hello world project 42
Time for acon – imporng the HelloWorldDemo sample applicaon 42
Running the applicaon 46
Time for acon – running an applicaon in the simulator 47
Table of Contents
[ ii ]
Debugging the applicaon 49
Time for acon – starng the debugger 50
Introducing Eclipse perspecves 52
Time for acon – changing the perspecve 52
Geng some help! 55
Time for acon – displaying the Help 55
Summary 58
Chapter 4: Creang your First BlackBerry Project 59
Choosing the SDK version 59
Creang a new project 60
Time for acon – creang a new project 60
Adding a package to the new project 62
Time for acon – creang a new project 63
Start at the beginning 65
Applicaon and UiApplicaon 65
Time for acon – adding the UiApplicaon class 65
A closer look at the code 68
Time for acon – expanding TipCalcApplicaon 69
MainScreen 71
Time for acon – adding a MainScreen 72
Determining your screen requirements 73
Time for acon – expanding the TIpCalcMainScreen 74
Time for acon – adding more to the MainScreen 75
Adding a menu to the applicaon 78
Time for acon – adding a menu to the MainScreen 78
Seng the SDK version 81
Time for acon – selecng the right component package 81
Tesng it out 84
Time for acon – running your new applicaon 84
Giving TipCalc some polish 86
Adding an icon to TipCalc 87
Time for acon – adding an icon 88
Time for acon – changing the applicaon tle 92
Fixing the Bill Amount eld 93
Time for acon – xing the bill amount eld 93
Disabling the save prompt 94
Time for acon – disabling the "save" dialog 94
Summary 95
Table of Contents
[ iii ]
Chapter 5: Learning the Basics About the UI 97
Geng to know other Field classes 97
SeparatorField 101
Time for acon – creang a SeparatorField 101
LabelField 102
Time for acon – creang a LabelField 102
BitmapField 103
Time for acon – creang a BitmapField 104
ChoiceField 105
ObjectChoiceField 106
Time for acon – creang an ObjectChoiceField 106
NumericChoiceField 108
Time for acon – creang a NumericChoiceField 108
GaugeField 109
Time for acon – creang a GaugeField 110
DateField 113
Time for acon – creang a DateField 114
CheckboxField 116
Time for acon – creang a CheckboxField 117
RadioBuonField 118
Time for acon – creang a RadioBuonField 119
TextField 122
BasicEditField 122
Time for acon – creang a BasicEditField 124
EditField 126
Time for acon – creang an EditField 126
PasswordEditField 127
Time for acon – creang a PasswordEditField 127
EmailAddressEditField 128
Time for acon – creang an EmailAddressField 128
AutoTextEditField 129
Time for acon – creang an AutoTextEditField 129
AcveAutoTextEditField 131
Time for acon – creang an AcveAutoTextEditField 131
RichTextField 133
Time for acon – creang a RichTextField 133
AcveRichTextField 136
Time for acon – creang an AcveRichTextField 137
Summary 139
Table of Contents
[ iv ]
Chapter 6: Going Deeper into the UI 141
BuonField 142
Time for acon – creang a BuonField 142
ListField 145
Time for acon – creang a ListField 145
TreeField 149
Time for acon – creang a TreeField 150
MapField 154
Time for acon – creang a MapField 154
Displaying another screen 155
Time for acon – creang an "About Screen" 156
Displaying a dialog 158
Time for acon – collecng informaon with a common dialog 159
Time for acon – collecng informaon with custom buons on a dialog 160
Time for acon – collecng informaon with a list on a dialog 162
Listeners and callbacks 164
Layout managers 164
Special consideraons for touchscreens 165
TouchEvents and TouchGestures 166
Summary 168
Chapter 7: Storing Data 171
Laying the ground work 171
Creang a data class 172
The Java way: RMS 172
Time for acon – creang and opening a RecordStore 174
Time for acon – adding a record 177
Time for acon – retrieving records 179
Time for acon – deleng records 182
The BlackBerry way: Persistent Store 184
PersistentStore and PersistentObject 184
Time for acon – preparing the JournalEntry class 185
Time for acon – geng a PersistentObject 186
Time for acon – accessing the PersistentObject data 188
Time for acon – accessing the PersistentObject data 189
Accessing removable storage 192
Connector and FileConnecon 193
Time for acon – storing data to a le 193
Time for acon – reading data from a le 198
Summary 202
Table of Contents
[ v ]
Chapter 8: Interfacing with Applicaons 203
Introducing PIM 204
Why is all so generic? 204
PIMLists 205
PIMItems 205
Laying the ground work 206
Time for acon – creang test contacts 206
Expanding your test contacts 212
Time for acon – adding telephone numbers 212
Expanding even more 215
Time for acon – adding e-mail addresses 215
Finishing the test contacts 217
Time for acon – adding e-mail addresses 217
Embedding the address book into your applicaon 220
Time for acon – embedding the address book 220
Adding the event to your calendar 224
Time for acon – adding an event to the calendar 225
Recurring events 227
Sending e-mail 229
Time for acon – sending an e-mail from an applicaon 230
Summary 233
Chapter 9: Networking 235
Threading 236
Connector class 236
HTTP basics 237
HTTP GET requests 238
Time for acon - HTTP Basics 238
HTTP POST requests 244
Time for acon – calling a web service 245
Time for acon – parsing the response 250
The transport—so many possibilies 255
Direct TCP/IP 255
MDS/BES 256
BIS-B 256
Wi-Fi 257
WAP 257
WAP 1.X 257
WAP 2.0 258
Debugging with the MDS simulator 258
Tesng for availability of transports 262
Time for acon – tesng for availability 263
Table of Contents
[ vi ]
Moving beyond HTTP connecons 266
Summary 268
Chapter 10: Advanced Topics 269
Introducing the Global Posioning System 270
The LocaonProvider class 270
Criteria 271
Three ways to get GPS data 271
Bringing it all together 272
Geng coordinates 273
Time for acon – acquiring a locaon 274
Expanding Hansel 285
Time for acon – expanding Hansel 285
Alternate entry points 294
Creang a focus icon 295
Time for acon – creang an alternate entry point project 296
Time for acon – adding a focus icon to Hansel 298
Summary 304
Chapter 11: Wrapping It All Up 305
Using resources for localizaon 306
Time for acon – adding a resource le 306
Resource bundles 309
Time for acon – adding a second resource le 310
Time for acon – populang a resource le and conguring the project 311
Time for acon – using a resource in your code 314
Code signing your applicaon 317
Time for acon – conguring projects to allow access 317
Time for acon – installing the code-signing keys 319
Time for acon – code-signing the applicaon 320
Distribung your applicaon through BlackBerry App World 324
Licensing models 325
Subming an applicaon 326
Summary 326
Appendix: Pop Quiz Answers 329
Chapter 2 329
Chapter 3 329
Chapter 4 330
Pop Quiz 1 330
Pop Quiz 2 330
Pop Quiz 3 330
Table of Contents
[ vii ]
Chapter 5 331
Pop Quiz 1 331
Pop Quiz 2 331
Pop Quiz 3 331
Pop Quiz 4 332
Pop Quiz 5 332
Chapter 6 332
Pop Quiz 1 332
Pop Quiz 2 333
Pop Quiz 3 333
Chapter 7 333
Pop Quiz 1 333
Pop Quiz 2 334
Pop Quiz 3 334
Chapter 8 334
Pop Quiz 1 334
Pop Quiz 2 335
Pop Quiz 3 335
Chapter 9 335
Pop Quiz 1 335
Pop Quiz 2 336
Pop Quiz 3 336
Chapter 10 336
Pop Quiz 1 336
Pop Quiz 2 337
Chapter 11 337
Index 457
Do wnload from Wow! eBook <www.wowebook.com>
Preface
The book teaches how to write rich, interacve, and smart BlackBerry applicaons in Java.
It expects the readers to know Java but not Java Mobile or the BlackBerry APIs. This book
will cover UI programming, data storage, programming network, and Internet API apps. As
we move on, you will learn more about the BlackBerry’s device features, such as messaging,
GPS, mulmedia, contacts and calendar, and so on. This book also helps you build your own
applicaons to illustrate the plaorm and the various capabilies that developers can use
in their programs.
What this book covers
Chapter 1, Introducing BlackBerry Applicaon Development gets you started by talking about
the capabilies of a BlackBerry smartphone and what kind of things can be done with these
capabilies with a custom applicaon. It talks about the other tools which are available and
why wring nave Java applicaons by using the BlackBerry SDK is the most powerful and
praccal approach to developing applicaons. Finally, it covers how to select which version
of the SDK to use and when you might want to use an older version of the SDK instead of
the latest.
Chapter 2, Installing the development Environment steps you through the process of
installing the proper versions of Java and Eclipse. This chapter talks about when to install
addional versions of the SDK and how to do so through the Eclipse over-the-air update
tool as well as how to install them manually.
Chapter 3, Geng Familiar with the Development Environment starts o the learning
process by imporng an exisng sample applicaon—the standard "Hello World"
applicaon. Aer imporng the project, the chapter will go over this simple applicaon
line-by-line. Aerwards, you will run the applicaon in the simulator and then introduce
a bug into the applicaon so that you can debug it as well.
Preface
[ 2 ]
Chapter 4, Creang your rst BlackBerry Project is where you create a new project from
scratch. This chapter demonstrates how you accomplish this using Eclipse and the various
wizards that are available within it. It also demonstrates how you can create a simple,
but complete applicaon quickly using the User Interface (UI) elements provided by the
framework.
Chapter 5, Learning the Basics about the UI creates an applicaon to demonstrate each
of the UI elements that are available to you when using the BlackBerry SDK. This sample
applicaon demonstrates how to set and retrieve data from each eld and discusses
when each eld should be used according to the BlackBerry development guidelines. By
demonstrang each eld, you will get a complete understanding of the capabilies of
each eld.
Chapter 6, Going Deeper into the UI picks up where the previous chapter leaves o by
demonstrang how to use some of the advanced elds, such as lists and trees. It also covers
navigaon between screens, displaying dialogs, and common paerns used in the BlackBerry
SDK. By the me you are done with this chapter, you will be well equipped to create the
enre UI for an applicaon.
Chapter 7, Storing Data jumps right into how to use the data storage tools of the SDK
and when it is appropriate to use each one. This covers the Java standard RMS, the
BlackBerry-specic PersistentStore, and even how to access the removable media
cards that are available on some devices.
Chapter 8, Interfacing with Applicaons shows you how to take advantage of one of most
powerful features available to a BlackBerry applicaon. Each BlackBerry device comes with
standard applicaons that you can interface with. These include the address book, calendar,
and even the messaging applicaons. Being able to ghtly integrate an applicaon with
these can make it even more valuable and useful to the end user.
Chapter 9, Networking wades into the complex, but an important area of how to make an
applicaon networking aware. Here, you will discover what transports are available, how to
open connecons , and how to send data through them. The sample also demonstrates how
to communicate with a simple web service and parse the resulng XML data.
Chapter 10, Advanced Topics covers two disnct, but powerful topics. The rst topic is
how to ulize the built-in GPS receiver that is built in to some smartphones in order to
get locaon informaon. You will learn about the various methods that can be used to get
locaon informaon and how to do some common calculaons using these coordinates. The
other topic covered in this chapter covers how to use alternate entry points so that a single
project can be used to launch mulple applicaons. Because these applicaons share a
common project, they can share code and even memory.
Preface
[ 3 ]
Chapter 11, Wrapping It All Up nishes the book with tasks that commonly are done last,
such as localizaon with language resource les and code-signing your applicaon so that
it can be installed on real devices. You will also learn what it takes to distribute your new
applicaon through the BlackBerry App World marketplace.
What you need for this book
In order to get started you don’t need anything at all except some starter code, which
is available with the code bundle of this book. Everything else that you will need will be
downloaded and installed through the course of this book, mostly in Chapter 2. In this
chapter, we will install the Java 2 JRE (Java Runme Environment) and JDE (Java
Development Environment), which are both needed to run Eclipse, the development
environment, and to compile the applicaons you will be making. Eclipse comes in several
versions from www.eclipse.org, but we will be using a version from RIM, which has been
pre-bundled with the BlackBerry SDK.
Beyond the soware needs you will also need experience with an object-oriented
development language such a Java, C#, or even C++. You should be familiar with common
object-oriented terms such as classes, members, inheritance, and even interfaces.
Furthermore, you should understand common concepts such as threading and serializaon.
Who this book is for
If you are a Java programmer who wants to build BlackBerry applicaons with Java,
this book is for you.
Conventions
In this book, you will nd several headings appearing frequently.
To give clear instrucons of how to complete a procedure or task, we use:
Time for action – heading
1. Acon 1
2. Acon 2
3. Acon 3
Preface
[ 4 ]
Instrucons oen need some extra explanaon so that they make sense, so they are
followed with:
What just happened?
This heading explains the working of tasks or instrucons that you have just completed.
You will also nd some other learning aids in the book, including:
Pop quiz – heading
These are short mulple choice quesons intended to help you test your own understanding.
Have a go hero – heading
These set praccal challenges and give you ideas for experimenng with what you have
learned.
You will also nd a number of styles of text that disnguish between dierent kinds of
informaon. Here are some examples of these styles, and an explanaon of their meaning.
Code words in text are shown as follows: "Next, you need to nd the
HelloWorldDemo
applicaon."
A block of code is set as follows:
public class TipCalcApplication extends UiApplication {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
Any command-line input or output is wrien as follows:
Feb 21, 2010 3:45:50 PM org.apache.coyote.http11.Http11BaseProtocol init
SEVERE: Error initializing endpoint
java.net.BindException: Address already in use: JVM_Bind:8080
New terms and important words are shown in bold. Words that you see on the screen, in
menus or dialog boxes for example, appear in the text like this: " Either go to File | Exit or
simply close the simulator window".
Do wnload from Wow! eBook <www.wowebook.com>
Preface
[ 5 ]
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this
book—what you liked or may have disliked. Reader feedback is important for us to develop
tles that you really get the most out of.
To send us general feedback, simply send an e-mail to
, and
menon the book tle via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in
the SUGGEST A TITLE form on
www.packtpub.com or e-mail
If there is a topic that you have experse in and you are interested in either wring or
contribung to a book on, see our author guide on
www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you
to get the most from your purchase.
Downloading the example code for this book
You can download the example code les for all Packt books you have purchased
from your account at . If you purchased this
book elsewhere, you can visit and
register to have the les e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen.
If you nd a mistake in one of our books—maybe a mistake in the text or the code—we
would be grateful if you would report this to us. By doing so, you can save other readers from
frustraon and help us improve subsequent versions of this book. If you nd any errata, please
report them by vising selecng your book, clicking
on the let us know link, and entering the details of your errata. Once your errata are veried,
your submission will be accepted and the errata will be uploaded on our website, or added
to any list of exisng errata, under the Errata secon of that tle. Any exisng errata can be
viewed by selecng your tle from />Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt,
we take the protecon of our copyright and licenses very seriously. If you come across any
illegal copies of our works, in any form, on the Internet, please provide us with the locaon
address or website name immediately so that we can pursue a remedy.
Please contact us at
with a link to the suspected pirated material.
We appreciate your help in protecng our authors, and our ability to bring you
valuable content.
Questions
You can contact us at if you are having a problem with any
aspect of the book, and we will do our best to address it.
1
Introducing BlackBerry Application
Development
The BlackBerry family of devices has long been the undisputed king of e-mail
for business professionals. In recent years, the company that makes BlackBerry
handhelds, Research In Moon (RIM), has been making devices targeted more
towards consumers with devices such as the Storm and Pearl. Because of this
shi the demand for quality applicaons has exploded in recent years. The
creaon of the BlackBerry App World has only fueled this growth and the size
of the opportunity. According to recent stascs, the BlackBerry App World has
the fewest number of tles and the highest average cost, all of which means
there is a big opportunity here!
Now, with more than 28 million subscribers and 60 million devices
manufactured, it is hard to go anywhere and not see someone using a
BlackBerry. Maybe you see these numbers as a ferle market for your
applicaon, or maybe your company has long ago standardized on
BlackBerry handhelds and you want to leverage that exisng investment.
Either way, you will learn how to tap into that potenal and create custom
applicaons for BlackBerry handhelds by using the object-oriented
development experience you already have.
Introducing BlackBerry Applicaon Development
[ 8 ]
In this chapter, we shall:
Learn about the two approaches to applicaon development
Learn generally what features can be used by an applicaon
Understand how the SDK version relates to target devices
Learn about the BlackBerry Developer Zone
So let's get on with it
Expectations of this book
This book is part of the Basic series which means we will start at the very beginning of the
learning curve. We start with the simplest task of geng the right tools downloaded and
installed. We then take you through to the nal stages of pung the last nishing touches
on your applicaon and then subming it to the BlackBerry App World so that the world can
use it. Along the way, we will cover each of the major areas of applicaon development: user
interface, storage, connecvity, and interfacing with other applicaons in ways that are clear
and useful.
There are a few things that we assume and that you should be familiar with before starng
down this road. The rst is an understanding of an object-oriented programming language.
BlackBerry development is done using Java, but you don't need to be a Java expert to get
started. Experience in C#, C++, or some other object-oriented language is enough to
get started.
Most of what we do will use the BlackBerry-specic APIs, but there are mes when an
understanding of basic Java framework is important, such as when we need to use threads.
For this I recommend having a Java book available as well.
The second is an understanding of general operang system concepts such as a le system,
messaging, events, processes, and threading. The BlackBerry APIs actually do a very good
job of hiding many of these details, but they are there and understanding them will help to
understand the big picture.
Chapter 1
[ 9 ]
General device capabilities
BlackBerry handhelds, like many smartphones today, are very powerful in spite of their
small size. The processing power and capabilies of these handhelds could accurately be
described as smaller versions of our desktops or laptops. They have many strong capabilies
yet have a small size that makes them convenient to carry around. This combinaon makes
smartphones in general, and BlackBerry handhelds in parcular, well suited for on-the-go
applicaons.
But just what can they do? There are so many possibilies! Let's take a look at the general
capabilies of BlackBerry handhelds.
Every handheld has a keyboard designed for typing on it. BlackBerry handhelds have
always been specically designed to send and receive e-mail, and as a result, the
keyboards are well-suited for entering free-form data. The BlackBerry SDK oers
no less than ten dierent kinds of text elds that can be used in nearly any kind of
applicaon. Plus, if you need something special, you can always create your own!
Another area that BlackBerry handhelds excel at is network connecvity. Again,
this is by design in order to provide excellent e-mail service. This connecvity
includes fully encrypted TCP/IP communicaon, and the ability to receive as well
as send raw data. Whether it be HTTP or UDP, the BlackBerry SDK supports all of
the major networking protocols and can handle receiving as well as sending data.
Furthermore, you can leverage the same secure protocols that are used to deliver
e-mail.
Most applicaons will need to store data on the local device. Applicaons can,
of course, store data on the device in their own private stores, but they can also
access and interface with other applicaons on the handheld. These include the
pre-installed applicaons such as messages, address book, and calendar that come
with the handheld.
Cameras are nearly ubiquitous on smartphones and can be accessed by an
applicaon as well.
Many newer devices include removable memory card slots for storage of large
media les. Applicaons can access this storage as well to give applicaons with
large storage needs the room to work.
Another feature that is extremely common on handhelds is a GPS receiver that
enables locaon-based service (LBS). This is one area that many in the smartphone
industry will say holds the most promise for the future.
Introducing BlackBerry Applicaon Development
[ 10 ]
Two different approaches to application development
If you've visited the BlackBerry Developer website you may have noced that there are
two recommended approaches to developing applicaons for BlackBerry handhelds—Java
Applicaon Development and BlackBerry Web Development. This book is focused on the
Java Applicaon Development approach, which is the more versale of the two, but the
other can be very useful in the right situaon.
Java Applicaon Development approach: This is the most powerful approach
and it creates applicaons wrien in Java that are loaded onto and executed on
a BlackBerry handheld. They will be the focus of this book and are one of the
most common ways to deploy an applicaon. Two dierent tools exist to support
this approach—the BlackBerry Java Development Environment (JDE) and the
BlackBerry JDE Component Plug-in for Eclipse. Both oer the ability to create full
custom applicaons. The BlackBerry JDE is a custom applicaon wrien in Java that
can be used to develop applicaons. The laer leverages the Eclipse Integrated
Development Environment (IDE), which is a common plaorm for Java developers.
BlackBerry Web Development approach: It is the other approach that runs
completely within the BlackBerry Browser applicaon and can use various
standards such as HTML and AJAX. Applicaons created using the BlackBerry Web
Development approach are similar to more common web applicaons and generally
require network connecvity to work. More powerful features, including nave API
calls, aren't allowed navely but can be made using BlackBerry Widgets. BlackBerry
Widgets is a separate SDK for creang small applets that can be leveraged by
web applicaons. Overall, this approach can be powerful but it requires network
connecvity, which potenally means data charges and/or delays for
network communicaon.
Choosing an SDK version
Before we dive into developing an applicaon we must choose the SDK version to work with.
In most environments, this choice is very simple—just choose the most recent version and
use that one. Unfortunately, things are not as simple for BlackBerry handhelds. In fact, it's
the opposite.
Do wnload from Wow! eBook <www.wowebook.com>