Writing MIDlet for SMS - I
9 April 2008SMS stands for Short Messaging Service and it is very common in mobile communication. J2ME provides an API for SMS which makes messaging very easy.
I will write a MIDlet to show how to create a messaging system using javax.wireless.messaging.
First step is to import all the required APIs:
import javax.microedition.midlet.*; import javax.microedition.io.*; import javax.microedition.lcdui.*; import javax.wireless.messaging.*; import java.io.IOException;
MIDlet class should extend MIDlet class. Since it will be a multithreaded application, we need to implement Runnable interface. To provide action listeners, we will also implement CommandListener and MessageListener interfaces.
public class SMSReceive extends MIDlet implements CommandListener, Runnable, MessageListener {
Now we may declare the commands we want to have in our MIDlet.
/** user interface command for indicating Exit request. */ Command exitCommand = new Command("Exit", Command.EXIT, 2); /** user interface command for indicating Reply request */ Command replyCommand = new Command("Reply", Command.OK, 1); /** user interface text box for the contents of the fetched URL. */
Do follow the next posts on this.
Related Posts:
- Writing MIDlet for SMS - VI
- Writing MIDlet for SMS - IV
- Writing MIDlet for SMS - II
- Deploying MIDlets onto Mobile Devices (III)
- MIDlet Suite
- Writing MIDlet for SMS - III
- Writing MIDlet for SMS - V
- Creating J2ME MIDlet Project - I
- Record Management System (III)
- Converting an existing project to an EclipseME project
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: Writing MIDlet for SMS - I