// ---sends an SMS message to another device---
private void sendSMS(String phoneNumber, String message) {
int i;
SmsManager sms = SmsManager.getDefault();
int amount = 10; // just making 10 the default if the EditText has an
// invalid value
try {
amount = Integer.parseInt(smsamount.getText().toString());
} catch (NumberFormatException smsamount) {
}
for (i = 0; i < amount; i++) {
if (amount < 100)
sms.sendTextMessage(phoneNumber, null, message, null, null);
else
Toast.makeText(getBaseContext(),
"Please enter an amount less than 100.",
Toast.LENGTH_SHORT).show();
}
}
This works, but the toast is staying on the screen for over a minute. It stays on the screen even after exiting the app. I have tried changing the toast to before the process to send the messages, but it force closes the app. Is this something that I am going to have to use the hack located here: http://thinkandroid.wordpress.com/2010/02/19/indefinite-toast-hack/ to make it shorter?