example.sms
Class SMSSender

java.lang.Object
  extended by example.sms.SMSSender
All Implemented Interfaces:
java.lang.Runnable, javax.microedition.lcdui.CommandListener

public class SMSSender
extends java.lang.Object
implements javax.microedition.lcdui.CommandListener, java.lang.Runnable

Prompts for text and sends it via an SMS MessageConnection


Field Summary
(package private)  javax.microedition.lcdui.Command backCommand
          user interface command for going back to the previous screen
(package private)  javax.microedition.lcdui.Displayable backScreen
          Where to return if the user hits "Back"
(package private)  java.lang.String destinationAddress
          The URL to send the message to
(package private)  javax.microedition.lcdui.Display display
          Display to use.
(package private)  javax.microedition.lcdui.TextBox messageBox
          Area where the user enters a message to send
(package private)  javax.microedition.lcdui.Command sendCommand
          user interface command for indicating Send request
(package private)  javax.microedition.lcdui.Displayable sendingScreen
          Displayed when a message is being sent
(package private)  java.lang.String smsPort
          The port on which we send SMS messages
 
Constructor Summary
SMSSender(java.lang.String smsPort, javax.microedition.lcdui.Display display, javax.microedition.lcdui.Displayable backScreen, javax.microedition.lcdui.Displayable sendingScreen)
          Initialize the MIDlet with the current display object and graphical components.
 
Method Summary
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable s)
          Respond to commands, including exit
 void promptAndSend(java.lang.String destinationAddress)
          Prompt for message and send it
 void run()
          Send the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sendCommand

javax.microedition.lcdui.Command sendCommand
user interface command for indicating Send request


backCommand

javax.microedition.lcdui.Command backCommand
user interface command for going back to the previous screen


display

javax.microedition.lcdui.Display display
Display to use.


smsPort

java.lang.String smsPort
The port on which we send SMS messages


destinationAddress

java.lang.String destinationAddress
The URL to send the message to


messageBox

javax.microedition.lcdui.TextBox messageBox
Area where the user enters a message to send


backScreen

javax.microedition.lcdui.Displayable backScreen
Where to return if the user hits "Back"


sendingScreen

javax.microedition.lcdui.Displayable sendingScreen
Displayed when a message is being sent

Constructor Detail

SMSSender

public SMSSender(java.lang.String smsPort,
                 javax.microedition.lcdui.Display display,
                 javax.microedition.lcdui.Displayable backScreen,
                 javax.microedition.lcdui.Displayable sendingScreen)
Initialize the MIDlet with the current display object and graphical components.

Method Detail

promptAndSend

public void promptAndSend(java.lang.String destinationAddress)
Prompt for message and send it


commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable s)
Respond to commands, including exit

Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener
Parameters:
c - user interface command requested
s - screen object initiating the request

run

public void run()
Send the message. Called on a separate thread so we don't have contention for the display

Specified by:
run in interface java.lang.Runnable