Home > Articles, Moblie Apps, Tech Tidbits, Web Design Coding / Scripts > How to write a BlackBerry application – Lesson 2: Mail API, Invoke API, Menu

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

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 HelloWorld.java and Lesson2Screen.java 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.

BlackBerry development article 2

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.

BlackBerry development

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.

BlackBerry development

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: www.twitter.com/FabianMH.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: