Java Reference
In-Depth Information
Thread t = new Thread(this);
t.start();
}
public boolean isSending() {
return sending;
}
public void run() {
sending = true;
try {
sendMMS();
} catch (Exception e) {}
sending = false;
}
private void sendMMS() {
String address = "mms://" + receiver + ":" + appId;
System.out.println(address);
MessageConnection c = null;
try {
c = (MessageConnection) Connector.open(address);
MultipartMessage mpm = (MultipartMessage) c.newMessage(
MessageConnection.MULTIPART_MESSAGE);
mpm.setSubject("MMSMIDlet Image");
if (image!=null) {
InputStream is = getClass().getResourceAsStream(image);
byte[] bImage = new byte[is.available()];
is.read(bImage);
mpm.addMessagePart(
new MessagePart(bImage, 0, bImage.length,
"image/png", "id1", null, null));
}
if (msg!=null) {
byte[] bMsg = msg.getBytes();
mpm.addMessagePart(
new MessagePart(bMsg, 0, bMsg.length,
"text/plain", "txt1", null, encoding));
}
c.send(mpm);
} catch (Exception e) {}
 
Search WWH ::




Custom Search