avoiding concurrent modification

This commit is contained in:
iNPUTmice 2014-12-13 22:17:27 +01:00
parent 6148f04d7b
commit fc293aaede
2 changed files with 3 additions and 6 deletions

View File

@ -383,7 +383,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null && intent.getAction() != null) {
if (intent.getAction().equals(ACTION_MERGE_PHONE_CONTACTS)) {
PhoneHelper.loadPhoneContacts(getApplicationContext(), this);
PhoneHelper.loadPhoneContacts(getApplicationContext(), new ArrayList<Bundle>(), this);
return START_STICKY;
} else if (intent.getAction().equals(Intent.ACTION_SHUTDOWN)) {
logoutAndSave();
@ -495,7 +495,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
this.databaseBackend.readRoster(account.getRoster());
}
initConversations();
PhoneHelper.loadPhoneContacts(getApplicationContext(),this);
PhoneHelper.loadPhoneContacts(getApplicationContext(),new ArrayList<Bundle>(), this);
getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true, contactObserver);
this.fileObserver.startWatching();

View File

@ -16,10 +16,7 @@ import android.provider.ContactsContract.Profile;
public class PhoneHelper {
public static void loadPhoneContacts(Context context,
final OnPhoneContactsLoadedListener listener) {
final List<Bundle> phoneContacts = new ArrayList<Bundle>();
public static void loadPhoneContacts(Context context,final List<Bundle> phoneContacts, final OnPhoneContactsLoadedListener listener) {
final String[] PROJECTION = new String[] { ContactsContract.Data._ID,
ContactsContract.Data.DISPLAY_NAME,
ContactsContract.Data.PHOTO_URI,