1
edit
Changes
no edit summary
== 9. Adding Send Email Functionality ==
9.1. Add couple of private variables to the <code>ViewStudentApp</code>:<br/> <source lang="java"> private static ServiceRecord[] _mailServiceRecords; public MessagesViewScreen _messagesViewScreen; </source>9.2. Add the Send email option to the menu and implement it:
<source lang="java">
// Send email to student
_mainScreen.addMenuItem(emailItem);
</source>
9.2 3 Add four new Screen classes and a helper class to the project:
* <code>ComposeScreen.java</code> - start screen where email is composed
* <code>MessageScreen.java</code> - screen showing the email
* <code>FoldersViewScreen.java</code> - view emails in the Outbox folder
The main functionality is taken from the Sample provided with blackberry plug-in: <code>BlackBerryMailDemo</code><br/>
9.34. Following is the modified code to accommodate the application:<br/>
<code>ComposeScreen.java</code>
<source lang="java">
</source>
Other classes stay unchanged.<br/>
9.45. Run the application, select a user from the list, and select Email Student from the menu:<br/>
[[Image: BB_email1.png | 300px]]
<br/>
9.56. Type in the subject and some text in the body, and select Send Email from the menu:<br/>
[[Image: BB_email2.png | 300px]]
[[Image: BB_email3.png | 300px]]<br/>
9.67. The messageList screen is displayed showing the created email. Select Folder View from the menu to see the Outbox folder:<br/>
[[Image: BB_email4.png | 300px]]
[[Image: BB_email5.png | 300px]]