From 2d41916750e2c31b57cf6325441ff37a8639fe93 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Thu, 6 Jul 2017 18:56:35 +0200 Subject: Fixed 'Only one Looper may be created per thread' RuntimeException according to https://stackoverflow.com/questions/23038682/java-lang-runtimeexception-only-one-looper-may-be-created-per-thread/24115631#24115631 --- .../conversationsplus/services/XmppConnectionService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java b/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java index 6a9b5c13..1d1f0108 100644 --- a/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java +++ b/src/main/java/de/thedevstack/conversationsplus/services/XmppConnectionService.java @@ -1018,7 +1018,10 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa account.initAccountServices(XmppConnectionService.this); //roster needs to be loaded at this stage } ImageUtil.evictBitmapCache(); - Looper.prepare(); + if (null == Looper.myLooper()) { + Looper.prepare(); + } + loadPhoneContacts(); Logging.d(Config.LOGTAG, "restoring messages"); for (Conversation conversation : conversations) { -- cgit v1.2.3