Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Start this thread to send SMS </p> <pre><code>public class SendSMS extends Thread { private String receiver; private String receivedMsg; private HomeScreen home; private boolean bool = false; private boolean notsent; public SendSMS(HomeScreen gen, String msg, String number) { this.home = gen; this.receiver = number; this.receivedMsg = msg; } public void run() { while (!bool) { SendMessage(); } } /** * Send the mesage using WMA api. */ private void SendMessage() { String s = "sms://" + receiver; send(s); } private void send(String url) { MessageConnection messageconnection = null; try { messageconnection = (MessageConnection) Connector.open(url); TextMessage textmessage = (TextMessage) messageconnection.newMessage(MessageConnection.TEXT_MESSAGE); textmessage.setAddress(url); textmessage.setPayloadText(receivedMsg); messageconnection.send(textmessage); } catch (Exception throwable) { notsent = true; home.genericObject.setSmsStatus(false); if (!home.isNokia()) { new PopUp("Message not sent"); // not sent } bool = true; try { messageconnection.close(); } catch (Exception e) { } } if (messageconnection != null) { try { messageconnection.close(); if (!notsent) { home.genericObject.setSmsStatus(false); if (!home.isNokia()) { new PopUp("Message Sent"); // sent } } bool = true; } catch (Exception ie) { ie.printStackTrace(); } } } } </code></pre> <p>Nokia devices don't show system alert if message is sent from j2me. So if you want to show alert, then you have to create your own PopUp and show.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload