private void closeConnection(HttpConnection conn, DataInputStream dis,
DataOutputStream dos)
{
if(conn!= null)
{
try
{
conn.close();
}
catch(IOException e)
{}
}
if(dis!=null)
{
try
{
dis.close();
}
catch(IOException e)
{}
}
if(dos!=null)
{
try
{
dos.close();
}
catch(IOException e)
{}
}
}
}
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
public class DisplayCanvas extends Form implements CommandListener
{
private UIController uicontroller;
private StringItem result;
private int index = 0;
private boolean first = true;
public static Command backCommand = new Command("Back", Command.BACK, 2);
public DisplayCanvas(UIController uicontroller)
{
super("Result");
this.uicontroller = uicontroller;
result = new StringItem("you have input:", null);
this.addCommand(backCommand);
this.setCommandListener(this);
}
public void init(String message)
{
if (first)
{
result.setText(message);
index = this.append(result);
first = false;
}
else
{
this.delete(index);
result.setText(message);
this.append(result);
}
}
public void commandAction(Command arg0, Displayable arg1)
{
uicontroller.handleEvent(UIController.EventID.DISPLAY_BACK_TO_INPUT,
null);
}
}