else if(label.equals("Send"))
{
try
{
clientConn=(MessageConnection)Connector.open("sms://"+name1);
}
catch(Exception e) {
alert = new Alert("Alert");
alert.setString("Unable to connect to Station because of network problem");
alert.setTimeout(2000);
display.setCurrent(alert);
}
try {
TextMessage textmessage = (TextMessage) clientConn.newMessage(MessageConnection.TEXT_MESSAGE);
textmessage.setAddress("sms://"+name1);
textmessage.setPayloadText(Address1);
clientConn.send(textmessage);
}
catch(Exception e)
{
Alert alert=new Alert("Alert","",null,AlertType.INFO);
alert.setTimeout(Alert.FOREVER);
alert.setString("Unable to send");
display.setCurrent(alert);
}
if (clientConn != null)
{
try
{
clientConn.close();
}
catch (Exception e)
{
Alert alert=new Alert("Alert","",null,AlertType.INFO);
alert.setTimeout(Alert.FOREVER);
alert.setString("Unable to close connection");
display.setCurrent(alert);
}
}
}