List of usage examples for android.support.v4.app FragmentManager popBackStackImmediate
public abstract boolean popBackStackImmediate();
From source file:org.linphone.ContactsManager.java
public synchronized void prepareContactsInBackgroundWithUI(final Activity activity, final FragmentManager manager, final ProgressDialog pd) { if (contactCursor != null) { contactCursor.close();// ww w .j a v a 2 s. c o m } if (sipContactCursor != null) { sipContactCursor.close(); } // if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)){ // contactList = new ArrayList<Contact>(); // for(LinphoneFriend friend : LinphoneManager.getLc().getFriendList()){ // Contact contact = new Contact(friend.getRefKey(),friend.getAddress()); // contactList.add(contact); // } // contactCursor = getFriendListCursor(contactList,true); // return; // } Log.e("LINPHONE", "preparing contacts in background:use_linphone_friend"); //if(mAccount == null) return; contactCursor = Compatibility.getContactsCursor(contentResolver, getContactsId()); Log.e("LINPHONE", "preparing contacts in background contactCursor" + contactCursor == null); sipContactCursor = Compatibility.getSIPContactsCursor(contentResolver, getContactsId()); Thread sipContactsHandler = new Thread(new Runnable() { @Override public void run() { if (sipContactCursor != null && sipContactCursor.getCount() > 0) { for (int i = 0; i < sipContactCursor.getCount(); i++) { Contact contact = Compatibility.getContact(contentResolver, sipContactCursor, i); if (contact == null) continue; contact.refresh(contentResolver); //Add tag to Linphone contact if it not existed if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_tag)) { if (!isContactHasLinphoneTag(contact, contentResolver)) { Compatibility.createLinphoneContactTag(context, contentResolver, contact, findRawContactID(contentResolver, String.valueOf(contact.getID()))); } } sipContactList.add(contact); } } if (contactCursor != null) { for (int i = 0; i < contactCursor.getCount(); i++) { Contact contact = Compatibility.getContact(contentResolver, contactCursor, i); if (contact == null) continue; //Remove linphone contact tag if the contact has no sip address if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_tag)) { if (removeContactTagIsNeeded(contact) && findRawLinphoneContactID(contact.getID()) != null) { removeLinphoneContactTag(contact); } } for (Contact c : sipContactList) { if (c != null && c.getID().equals(contact.getID())) { contact = c; break; } } contactList.add(contact); } activity.runOnUiThread(new Runnable() { @Override public void run() { pd.dismiss(); manager.popBackStackImmediate(); } }); } } }); contactList = new ArrayList<Contact>(); sipContactList = new ArrayList<Contact>(); sipContactsHandler.start(); }