Send all sms messages from the main thread
authorMarius Gavrilescu <marius@ieval.ro>
Mon, 29 Jul 2013 08:51:36 +0000 (11:51 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Mon, 29 Jul 2013 08:51:36 +0000 (11:51 +0300)
src/ro/ieval/fonbot/Utils.java

index 5c54f86e89b8ca38cfc5572eca732918fe05db90..9a23d04afcd09f585b16c448274176fdbca51bff 100644 (file)
@@ -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:
This page took 0.011278 seconds and 4 git commands to generate.