Writing MIDlet for SMS - II
11 April 2008This post is in continuation of: Writing MIDlet for SMS - I. Do read that one before that.
I will continue with writing the MIDlet.
Now we will declare other stuff (Thread, Alert, String arrays etc) as shown below:
Alert content; /** current display. */ Display display; /** instance of a thread for asynchronous networking and user interface. */ Thread thread; /** Connections detected at start up. */ String[] connections; /** Flag to signal end of processing. */ boolean done; /** The port on which we listen for SMS messages */ String smsPort; /** SMS message connection for inbound text messages. */ MessageConnection smsconn = null; /** Current message read from the network. */ Message msg; /** Address of the message's sender */ String senderAddress; /** Alert that is displayed when replying */ Alert sendingMessageAlert; /** Prompts for and sends the text reply */ SMSSender sender; /** The screen to display when we return from being paused */ Displayable resumeScreen;
We need to initialize the MIDlet with the current display object and graphical components. I will do that in the SMSReceive method as shown below.
public SMSReceive() { smsPort = getAppProperty("SMS-Port"); display = Display.getDisplay(this); content = new Alert("SMS Receive"); content.setTimeout(Alert.FOREVER); content.addCommand(exitCommand); content.setCommandListener(this); content.setString("Receiving..."); sendingMessageAlert = new Alert("SMS", null, null, AlertType.INFO); sendingMessageAlert.setTimeout(5000); sendingMessageAlert.setCommandListener(this); sender = new SMSSender(smsPort, display, content, sendingMessageAlert); resumeScreen = content; }
Do follow the next post.
Related Posts:
- Writing MIDlet for SMS - VI
- Writing MIDlet for SMS - IV
- Writing MIDlet for SMS - I
- 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 - II