public synchronized void run()
{
Message msg = null;
String text = null;
String originator = null;
while (go)
{
try
{
mc = (MessageConnection) Connector.open("sms://+7500");
msg = mc.receive();
if (msg instanceof TextMessage)
{
originator = msg.getAddress();
TextMessage tmsg = (TextMessage) msg;
text = tmsg.getPayloadText();
..//
Form form = new Form(originator);
form.append(text);
..//
display.setCurrent(form);
}
}
catch (InterruptedIOException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
if (mc != null)
{
try
{
mc.close();
mc = null;
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
}
}
}