Source Code

How to write a BlackBerry application – Lesson 2: Mail API, Invoke API, Menu

  • Fabian M. Heuwieser
  • 27 June 2014 at 00:01
  • Blackberry
  • 1506
  • 3
  • United States

Author: Fabian M. Heuwieser Language: United States
License: Freeware
Size: 0 KB
Downloads: 4 times


How to write your second BlackBerry application – Lesson 2: Mail API, Invoke API, Menu

In the first tutorial you learned how to set up the BlackBerry JDK (Java Development Kit) and how to create a simple User Interface with Buttons, Labels and Edit Fields.

In this lesson, you’ll learn how one can program, create and compose email messages as well as how to add a MenuItem to your application.

1. You open up the JDE (Java Development Environment) and load your Workspace file. Go to File -> Recent Workspaces to load up the Lections.jdw file.
2. Now right-click on Lections.jdw and select Create new Project
3. Name it Lection_2
4. Now right-click on Lection_2 and select Add file to Project
5. Select both files and to import them into the project
6. You now have the project set up and are ready to jump into the code

What the application allows you to do is the following:

It gives you 3 EditFields where you can enter data. It also provides you with 2 ButtonFields.

The one button is called Create email and when you click that button it pops up a new email message with the data you entered in the fields. From there, you can send the email.


The other button is called Send email and after you click the button, it sends off the email straight from your app without showing the form where you can still edit the message. Then, when you go into your Messages Application you find the sent mail there.


What else do I learn in this lesson?

You learn how to insert colored fields into the screen and you learn how to add a MenuItem to your app.


What else is there to know about this lesson?

We imported two new APIs into our project:

import net.rim.blackberry.api.invoke.*;
import net.rim.blackberry.api.mail.*;

The invoke-API is needed to invoke the Messages application to pop up that email form and the mail-API is needed to send of the email from the Send email button. For a complete list of all APIs you can go to Help -> API Reference.

Is there anything specific you want me to cover in the next lesson?

Drop your thoughts in the comments or reply to me on Twitter:

comments powered by Disqus

Related Code

How to write your first BlackBerry application – Lesson 1: UI fields

Mysql Response too slow accessed from website

Get Content of RSS Pasarkode

Apache setting for CodeIgniter when upload in sub domain

Ajax load content

Import Large Database File Size

Get Location Using GeoPlugin

Change Number To Rupiah Format (Indonesian Currency)

Javascript Get Only Number and Get Only String

Create Random Code


Tag Linked