Java Reference
In-Depth Information
public class StockQuoteDemo extends MIDlet implements CommandListener
{
Form mainForm = new Form ("StockQuotes");
TextField symbolField = new TextField ("Symbol", "IBM", 5,
TextField.ANY);
StringItem resultItem = new StringItem ("", "");
Command getCommand = new Command ("Get", Command.SCREEN, 1);
public StockQuoteDemo() {
mainForm.append (symbolField);
mainForm.append (resultItem);
mainForm.addCommand (getCommand);
mainForm.setCommandListener(this);
}
public void startApp() {
Display.getDisplay (this).setCurrent (mainForm);
}
public void pauseApp() {
}
public void destroyApp (boolean unconditional) {
}
public void commandAction (Command c, Displayable d) {
try {
// build request string
String symbol = symbolField.getString();
resultItem.setLabel (symbol);
SoapObject rpc = new SoapObject
("urn:xmethods-delayed-quotes", "getQuote");
rpc.addProperty ("symbol", symbol);
HttpTransport transport = new HttpTransport
("http://services.xmethods.net:9090/soap",
"urn:xmethods-delayed-quotes#getQuote");
Object result = transport.call (rpc);
resultItem.setText (""+result);
}
catch (Exception e) {
resultItem.setLabel ("Error:");
resultItem.setText (e.toString());
}
}
MathFP
Because CLDC doesn't provide the primitive Java types float and double or the corresponding
classes Float and Double , it seems that you cannot write a J2ME CLDC application that performs
 
Search WWH ::




Custom Search