PocketMagic

PocketMagic

Where Technology meets magic


Android
47 Posts
BlackBerry
4 Posts
Electronics
69 Posts
Hardware
123 Posts
High Voltage
49 Posts
Image processing
2 Posts
iPhone
4 Posts
Linux
2 Posts
Nuclear
20 Posts
Optics
11 Posts
Photography
7 Posts
Photoshop
3 Posts
Research
19 Posts
Reviews
18 Posts
Robotics
8 Posts
Security
7 Posts
Software
76 Posts
Symbian
2 Posts
Tubes
20 Posts
Windows
3 Posts
Windows Mobile
11 Posts

Top Articles!       See PocketMagic on Facebook


Building a robot – Part 2 | 8827 Views | Rate 67.38
Building a robot – Part 2
uRADMonitor - Online Radiation monitoring station | 16082 Views | Rate 67.01
uRADMonitor - Online Radiation monitoring station
Bluetooth and iOS - Use Bluetooth in your iPhone apps | 21964 Views | Rate 65.18
Bluetooth and iOS - Use Bluetooth in your iPhone apps
NMEA GPS Library for AVR Microcontrollers | 5807 Views | Rate 51.39
NMEA GPS Library for AVR Microcontrollers
Programmatically Injecting Events on Android - Part 2 | 6506 Views | Rate 46.81
Programmatically Injecting Events on Android - Part 2
Simple Switched power Supplies | 18990 Views | Rate 45.98
Simple Switched power Supplies
Cartoon yourself using Leptonica | 134 Views | Rate 44.67
Cartoon yourself using Leptonica
A 3D Carousel View for Android | 206 Views | Rate 41.2
A 3D Carousel View for Android

 
  

Developing for BlackBerry – introduction


By Radu Motisan Posted on February 19th, 2009 , 2391 Views (Rate 1.51)



  
These days I got a Blackberry 8100.
Looking at it through the prism of Windows Mobile standards I'm used with, I can say that I'm very disappointed. But that's another story. In this one I'll quickly show you how to get things going when you want to do your first app for a BlackBerry.

Things described in this article:
- how to take screen captures from your Blackberry
- how to upgrade your BlackBerry's OS software
- what development tools you need if you want to code for BlackBerry
- a first Hello World app, including Basic controls, basic message handling, image loading and drawing
- how to upload an application to your BlackBerry and how to run it

First you should know that RIM's OS evolved in time, and that there are several versions available. My 8100 came with version 4.2 installed as you can see here:

If you need to take screen captures from your BlackBerry's screen, you might want to read this tutorial or download this tool directly.

Latest OS version for the 8100 was 4.5, so I decided to run the upgrade.
Here's another tutorial on how to do this. Here's another screenshot showing my current version:

Getting the right tools to develop my first application for BlackBerry was a real pain.
First I've tried the Visual Studio plugin for Blackberry, available on RIM's website. It worked in the simulator but it didn't work with the device - and it had nothing to do with the restricted APIs since I've only tried to put a button and display a messagebox. The compiled files were uploaded successfully to the 8100, but I couldn't find them in the programs list.

The second attempt was using Eclipse and the BlackBerry plugin. Lots of settings, if you are interested you can read more on that here. I gave it up when I managed to use the BlackBerry JDE.

So the easy way for me was to download the Blackberry JDE from this link. It also comes with a simulator in case you don't have a physical device to test.
I currently have the 4.2 version installed.

In the JDE, simply create a new Workspace, inside a new project, and there a JAVA file. You'll find some code you can use later in this post. Compiling your program will result in a .cod file. You can generate an ALX file from the menu Project->Generate ALX file. The cod and the alx can be used by the BlackBerry Desktop Manager to upload your program to the mobile device. It's straight forward, you'll manage to do this.

Alternatively you can use the Javaloader.exe to upload / delete your programs from the BlackBerry. Connect your BlackBerry to the PC via the USB Cable and use these parameters:
JavaLoader.exe -usb load your_program.cod
and to delete the program from the device:
JavaLoader.exe -usb erase -f your_program.cod

Once uploaded, your code will show up in the BlackBerry's programs list:

Regarding coding, you must know Java. But that's easy. My Java knowledge level was almost 0 when I've started doing this Hello World app, and by doing it, I was able to learn about creating controls dynamically ( new RichTextField), creating Timers (new Timer() .. timer.schedule ( new ToDoTask.. ), loading images (Bitmap.getBitmapResource("helloworld_jde.png")), handling paint events (public void paint(Graphics g) ) and handling user's key inputs (public boolean keyChar(char key, int status, int time) ).

The sample, including the .cod file can be downloaded here:
helloworld-bjde
Basically you have everything you need there, to start doing a simple game of some kind.
And compared to Window Mobile C++ win32 API programming it's easier. But not as powerful.


  

More on PocketMagic:

Atmega8 and enc28J60 for ethernet support | 8811 Views | Rate 27.28
Atmega8 and enc28J60 for ethernet support
How to make metallic sodium | 1404 Views | Rate 27
How to make metallic sodium
Tube: USN-5J29 | 1074 Views | Rate 26.2
Tube: USN-5J29
Tube: GP-5 (ГП-5) | 623 Views | Rate 25.96
Tube: GP-5 (ГП-5)
How to set the AVR Fusebits | 2523 Views | Rate 25.48
How to set the AVR Fusebits
Dual H-Bridge for controlling two motors | 2085 Views | Rate 25.12
Dual H-Bridge for controlling two motors

2 Responses to “Developing for BlackBerry – introduction”

  1. 1
    Developing for Blackberry -part 3- « PocketMagic:

    [...] Radu Motisan Posted on January 11th, 2012 Some time has past since my first experience with Blackberry. 3 years! It's the same boring and limited platform, but at least the tools have [...]

  2. 2
    Developing for Blackberry 10 « PocketMagic:

    [...] In a world dominated by Android and iOS, how hard is it for another mobile platform, be it one bearing the glory of the past, to reconquer the market shares it once had? It's all about marketing, a bit of luck, but from my point of view (not generally applicable, see how iOS started), the technology involved – the actual value resulting from the time and effort invested in making something better. Blackberry has reinvented itself in a new, fierce competitor with its latest release, the Blackberry 10. The handsets running the new OS are impressive: huge 768 x 1280 pixel screens, 8Mega pixel camera (with geotagging and face detection), 2GB of Ram memory and a Dual-core 1.5 GHz Krait processor. A beast in terms of hardware capabilities but also a huge step forward. [...]

Thank you for commenting. Your comment won't show until approved, which can take some time.

Please copy the string GOcPo5 to the field below: