subjectField.setFocus();
} else if (message.length() == 0) {
errorDialog("Message field cannot be blank");
messageField.setFocus();
} else {
MultipartMessage multipartMessage = null;
try {
// Open an MMS connection for sending
_sendConn = Connector.open("mms://" + address + ":" + APP_ID);
// Create the multipart message and set the subject
multipartMessage =
(MultipartMessage) ((MessageConnection) _sendConn)
.newMessage(MessageConnection.MULTIPART_MESSAGE);
multipartMessage.setSubject(subject);
// Add the message text to the multipart message
multipartMessage.addMessagePart(new MessagePart(message
.getBytes(), "text/plain", "text", null, null));
// Add any attachments
for (int i = 0; i < _messageParts.getNumberOfRows(); i++) {
multipartMessage.addMessagePart((MessagePart) _messageParts
.getRow(i));
}
} catch (final IOException ioe) {
errorDialog(ioe.toString() + " when creating message.");
}