Needing to have sms delayed before sending
<p>I know this has been asked multiple times, but I am having problems making it work or figuring out what will work best. I need to have the sms wait 2-3 seconds between each message before sending another message. I have looked at and tried handlers, timers and thread sleep and I am not sure which one would be the best use in my situation, or how to make it work right. I am still new to programming, so please take it easy on me.</p>

<pre><code>// ---sends an SMS message---
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) {
    }

    if (amount &lt; 501) {
        for (i = 0; i &lt; amount; i++) {
        sms.sendTextMessage(phoneNumber, null, message, sentPI, null);
        }
</code></pre>
