I am writing a MIDlet to send a mms message.
The IDE I am using is eclipse-pulsar-galileo-win32.
The skd i am using is Java(TM) ME platform SDK 3.0.
The emulator i am using porvides WMA 2.0.
But my eclipse does not know MessageConnection.MULTIPART_MESSAGE.
There is an error in this line.
MultipartMessage msg=(MultipartMessage)connection.newMessage(MessageConnection.MULTIPART_MESSAGE);
here is my coding. What causes the problem?
Code:public class MMS implements Runnable { public void run() { MessageConnection connection=null; try { connection=(MessageConnection) Connector.open("mms://987654321",Connector.READ_WRITE); MultipartMessage msg=(MultipartMessage) connection.newMessage(MessageConnection.MULTIPART_MESSAGE); msg.addAddress("cc", "mms://987654321"); MessagePart part1=new MessagePart("hello".getBytes(),0,5,"text",String.valueOf(1),null,"UTF-8"); MessagePart part2=new MessagePart("When".getBytes(),0,4,"text",String.valueOf(2),null,"UTF-8"); InputStream is = getClass().getResourceAsStream("star.png"); byte[] bImage = new byte[is.available()]; is.read(bImage); //MessagePart part3=new MessagePart(is,"image/png",String.valueOf(3),null,null); //MessagePart part3=new MessagePart(bImage,0,bImage.length,"image/png",String.valueOf(3),null,null); msg.addMessagePart(part1); msg.addMessagePart(part2); //msg.addMessagePart(part3); msg.setStartContentId("1"); msg.setSubject("Testing"); connection.send(msg); } catch (IOException e){ // TODO Auto-generated catch -block e.printStackTrace(); } } }

Reply With Quote

