Java Reference
In-Depth Information
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command c, Displayable s) {
if (c == mExitCommand) {
destroyApp(false);
notifyDestroyed();
}
else if (c == mFindCommand) {
// Show the progress form.
mDisplay.setCurrent(mProgressForm);
// Kick off the thread to do the query.
Thread t = new Thread(this);
t.start();
}
}
public void run() {
String word = mSubmitBox.getString();
String definition;
try { definition = lookUp(word); }
catch (IOException ioe) {
Alert report = new Alert(
"Sorry",
"Something went wrong and that " +
"definition could not be retrieved.",
null, null);
report.setTimeout(Alert.FOREVER);
mDisplay.setCurrent(report, mSubmitBox);
return;
}
Alert results = new Alert("Definition", definition,
null, null);
results.setTimeout(Alert.FOREVER);
mDisplay.setCurrent(results, mSubmitBox);
}
private String lookUp(String word) throws IOException {
HttpConnection hc = null;
InputStream in = null;
String definition = null;
Search WWH ::




Custom Search