Writing MIDlet for SMS - II

11 April 2008

This 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.

del.icio.us:Writing MIDlet for SMS - II  digg:Writing MIDlet for SMS - II  spurl:Writing MIDlet for SMS - II  wists:Writing MIDlet for SMS - II  simpy:Writing MIDlet for SMS - II  newsvine:Writing MIDlet for SMS - II  blinklist:Writing MIDlet for SMS - II  furl:Writing MIDlet for SMS - II  reddit:Writing MIDlet for SMS - II  fark:Writing MIDlet for SMS - II  blogmarks:Writing MIDlet for SMS - II  Y!:Writing MIDlet for SMS - II  smarking:Writing MIDlet for SMS - II  magnolia:Writing MIDlet for SMS - II  segnalo:Writing MIDlet for SMS - II  gifttagging:Writing MIDlet for SMS - II

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

Leave a Reply