From: Marius Gavrilescu Date: Mon, 29 Jul 2013 08:51:36 +0000 (+0300) Subject: Send all sms messages from the main thread X-Git-Tag: 0.000_001~14 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=24ebe0410d664e354a3ac6bdfb2d52188f889ab6;p=fonbot.git Send all sms messages from the main thread --- diff --git a/src/ro/ieval/fonbot/Utils.java b/src/ro/ieval/fonbot/Utils.java index 5c54f86..9a23d04 100644 --- a/src/ro/ieval/fonbot/Utils.java +++ b/src/ro/ieval/fonbot/Utils.java @@ -18,6 +18,8 @@ import android.database.Cursor; import android.location.LocationManager; import android.media.AudioManager; import android.net.Uri; +import android.os.Handler; +import android.os.Looper; import android.preference.PreferenceManager; import android.provider.ContactsContract.PhoneLookup; import android.telephony.SmsManager; @@ -299,7 +301,12 @@ public final class Utils { break; case SMS: - SmsManager.getDefault().sendTextMessage(address.data, null, message, null, null); + new Handler(Looper.getMainLooper()).post(new Runnable(){ + @Override + public void run(){ + SmsManager.getDefault().sendTextMessage(address.data, null, message, null, null); + } + }); break; case LOCAL: