Hi San
I call this method inside the onClick(). I have defined two buttons
"Send" and "Cancel". If the user clicks on the "Send" button, i call
the sendSMS method. Below is my onClick() code-
public void onClick(View v) {
switch (v.getId()) {
case R.id.friendSMSSend:
if (numberToSend == null) {
numberToSend =
contactView.getEditableText().toString();
if (!numberToSend.equals("")) {
sendSMS(numberToSend,
AppState.friendSMSText);
} else {
Toast.makeText(this, "Please enter the
number",
Toast.LENGTH_SHORT).show();
}
}
break;
case R.id.friendSMSCancel:
finish();
break;
}
}
On Sep 1, 10:37 pm, San <[email protected]> wrote:
> When/where do you call this method?
>
> On Sep 1, 10:27 am, Amit <[email protected]> wrote:
>
>
>
> > Hi All,
>
> > I am facing one issue on my HTC tattoo device.
>
> > I have written a code which sends an SMS to the given number. At the
> > recipient end I am receiving more than one SMSs. One time I have even
> > received 17 same messages.
>
> > I am posting the code snippet for the reference-
>
> > private void sendSMS(final String phoneNumber, final String message) {
> > Log.i("Send To Friend", "sendSMS");
> > SmsManager sms = SmsManager.getDefault();
> > sms.sendTextMessage(phoneNumber, null, message, null, null);
> > Toast.makeText(this, "Message has been sent",
> > Toast.LENGTH_SHORT)
> > .show();
> > finish();
>
> > }
>
> > Please help in this regard.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en