Motorola i88s manual Motorola Inc I88s J2ME Developers’ Guide

Page 25

Motorola Inc.

i88s J2ME Developers’ Guide

/**

*Start running

*/

protected void startApp() {

myDisplay = Display.getDisplay(this); myOutput = new Form("Results");

myList = new List("Select test:", List.IMPLICIT, testList,

null);

okCommand = new Command("OK", Command.OK, 1); myOutput.addCommand(okCommand); myList.addCommand(okCommand); myOutput.setCommandListener(this); myList.setCommandListener(this);

tf1 = new TextBox("file to w/r", fileURL, 28, TextField.ANY); tf1.addCommand(okCommand); tf1.setCommandListener(this);

tf2 = new TextBox("Set Data to Send", stringNum, 28, TextField.ANY); tf2.addCommand(okCommand);

tf2.setCommandListener(this);

myDisplay.setCurrent(myList);

}

/**

*Stop running

*/

protected void pauseApp() {

}

/**

*Destroy App

*/

protected void destroyApp(boolean unconditional) {

}

/**

*Handle ok command

*/

public void commandAction(Command c, Displayable s) {

if (((s == tf1) (s == tf2)) && (c == okCommand)) { if(s==tf1) fileURL = tf1.getString(); if(s==tf2) {

/* data in the string form */ stringNum = tf2.getString();

/* convert the string into the integer form */ dataNum = stringNum.length();

}

}

if (s == myList) {

switch (((List)s).getSelectedIndex()) { case 0:

myDisplay.setCurrent(myOutput);

setFileName();

break;

case 1: myDisplay.setCurrent(myOutput); setData();

break;

case 2: myDisplay.setCurrent(myOutput);

Version 1.0 - Page 25

Image 25
Contents I88s Multi-Communication Device J2ME Developers’ Guide J2ME Networking Disclaimer Document OverviewAcronyms and Definitions Contact InformationAcronyms Used In This Guide Terminology Definition Overview Agps On The i88s PhoneAccuracy Position APIAssist Data Almanac Out Of Date PositionConnection ClassExample Retrieving Position in Java Method DescriptionsGetPosition GetPositionString nameGetStatus Using Position in JavaExample Using PositionConnection Positionresponsenoalmanacoverride Addition, to obtain better accurate speed and direction Recommendation Http Https J2ME NetworkingClass Descriptions Https HttpSupported Protocols on the i88s Phone SSL Secure Sockets TCP SocketsServerSockets UDP Sockets Serial Port AccessCommunicating on a Port Connection Optional ParametersImplementation Notes Example using StreamConnectionConcurrent Connections For The i88s Phone Protocol Maximum Tips Class Description File I/O Method Descriptions Opening a file Reading and Writing Deleting a fileCode Examples Example # 2 Complete MIDlet code Motorola Inc I88s J2ME Developers’ Guide Os = sc.openOutputStream //get InputStream Sc.close Caveats Motorola Inc I88s J2ME Developers’ Guide
Related manuals
Manual 43 pages 17.94 Kb