the correct code to send a sms directly is as follows,
number is a string with the phone number of the target device,
msg a string with the message you want to send.
Code:
MessageConnection _dc = (MessageConnection)Connector.open("sms://"+number);
Message sms = _dc.newMessage(MessageConnection.TEXT_MESSAGE);
TextMessage sms2 = (TextMessage)sms;
sms2.setPayloadText(msg);
_dc.send(sms2);
this is using a secure api, you need to sign your code using the $100 signing key.
be sure to use this inside an own thread.
@pa4o85: your code is a bit strange. you open a connection just to close it in the next line... and why would you want to create a message manually when you invoke the sms-application anyhow?
hth,
simon