Writing MIDlet for SMS - VI
11 April 2008This is the final part of “Writing MIDlet for SMS “. This post presents commandAction method which is a command listener.
The following methiod responds to commands for example exit, reply etc.
public void commandAction(Command c, Displayable s) { try { if (c == exitCommand || c == Alert.DISMISS_COMMAND) { destroyApp(false); notifyDestroyed(); } else if (c == replyCommand) { reply(); } } catch (Exception ex) { ex.printStackTrace(); } } // Allow the user to reply to the received message private void reply() { // remove the leading "sms://" for diplaying the destination address String address = senderAddress.substring(6); String statusMessage = "Sending message to " + address + "..."; sendingMessageAlert.setString(statusMessage); sender.promptAndSend(senderAddress); }
I hope you have gone through all parts of “Writing MIDlet for SMS”. Put the code together and try it yourself. Do some experiments and explore more. Remember, you will learn a lot while doing experiments.
Happy coding!!
Related Posts:
- Writing MIDlet for SMS - IV
- Writing MIDlet for SMS - I
- 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 - VI