	public Collection<ContactGroup> getContactGroups(Context context,
			long directoryId) {
		final String starredContacts = context.getString(R.string.starredContacts);
		final String myContacts = context.getString(R.string.myContacts);
		Comparator<ContactGroup> comparator = new Comparator<ContactGroup>() {
			@Override
			public int compare(ContactGroup g1, ContactGroup g2) {
				if (myContacts.equalsIgnoreCase(g1.getTitle())) {
					return -1;
				} else if (myContacts.equalsIgnoreCase(g2.getTitle())) {
					return 1;
				} else if (starredContacts.equalsIgnoreCase(g1.getTitle())
						|| STARRED_CONTACTS_ENG.equalsIgnoreCase(g1.getTitle())) {
					return -1;
				} else if (starredContacts.equalsIgnoreCase(g2.getTitle())
						|| STARRED_CONTACTS_ENG.equalsIgnoreCase(g2.getTitle())) {
					return 1;
				}
				return g1.getTitle().compareTo(g2.getTitle());
			}
		};
		final Collection<ContactGroup> groups = new TreeSet<ContactGroup>(
				comparator);
		Uri uri = ContactsContract.Groups.CONTENT_URI;
		String[] projection = new String[] { ContactsContract.Groups._ID,
				ContactsContract.Groups.ACCOUNT_NAME,
				ContactsContract.Groups.ACCOUNT_TYPE,
				ContactsContract.Groups.TITLE, };
		String selection = null;
		String[] selectionArgs = null;
		String sortOrder = ContactsContract.Groups.TITLE
				+ " COLLATE LOCALIZED ASC"; 
		CursorLoader loader = new CursorLoader(context, uri, projection,
				selection, selectionArgs, sortOrder);
		Cursor cursor = null;
		boolean foundStarredGroup = false;
		boolean foundMyContacts = false;
		try {
			loader.startLoading();
			cursor = loader.loadInBackground();
			if (cursor == null) {
				return groups;
			}
			cursor.moveToFirst();
			while (cursor.isAfterLast() == false) {
				long groupId = cursor.getLong(0);
				String accountName = cursor.getString(1);
				String accountType = cursor.getString(2);
				String title = cursor.getString(3);
				if (title == null || title.equalsIgnoreCase(myContacts)) { 
					if (foundMyContacts) {
						cursor.moveToNext();
						continue;
					}
					foundMyContacts = true;
					groupId = ContactsWidgetConfigurationActivity.CONTACT_MY_CONTACTS_GROUP_ID;
				} else if (title.equalsIgnoreCase(starredContacts)
						|| STARRED_CONTACTS_ENG.equalsIgnoreCase(title)) {
					foundStarredGroup = true;
					groupId = ContactsWidgetConfigurationActivity.CONTACT_STARRED_GROUP_ID;
				}
				ContactGroup group = new ContactGroup(groupId, accountName,
						accountType, title);
				groups.add(group);
				cursor.moveToNext();
			}
		} finally {
			loader.stopLoading();
			if (cursor != null) {
				cursor.close();
			}
		}
		if (!foundStarredGroup) {
			ContactGroup group = new ContactGroup(
					ContactsWidgetConfigurationActivity.CONTACT_STARRED_GROUP_ID, starredContacts,
					null, starredContacts);
			groups.add(group);
		}
		if (!foundMyContacts) {
			ContactGroup group = new ContactGroup(
					ContactsWidgetConfigurationActivity.CONTACT_MY_CONTACTS_GROUP_ID, myContacts,
					null, myContacts);
			groups.add(group);
		}
		return groups;
	}

	public Collection<ContactGroup> getContactGroups(Context context,
			long directoryId) {
		final String starredContacts = context.getString(R.string.starredContacts);
		final String myContacts = context.getString(R.string.myContacts);
		Comparator<ContactGroup> comparator = new Comparator<ContactGroup>() {
			@Override
			public int compare(ContactGroup g1, ContactGroup g2) {
				if (myContacts.equalsIgnoreCase(g1.getTitle())) {
					return -1;
				} else if (myContacts.equalsIgnoreCase(g2.getTitle())) {
					return 1;
				} else if (starredContacts.equalsIgnoreCase(g1.getTitle())
						|| STARRED_CONTACTS_ENG.equalsIgnoreCase(g1.getTitle())) {
					return -1;
				} else if (starredContacts.equalsIgnoreCase(g2.getTitle())
						|| STARRED_CONTACTS_ENG.equalsIgnoreCase(g2.getTitle())) {
					return 1;
				}
				return g1.getTitle().compareTo(g2.getTitle());
			}
		};
		final Collection<ContactGroup> groups = new TreeSet<ContactGroup>(
				comparator);
		Uri uri = ContactsContract.Groups.CONTENT_URI;
		String[] projection = new String[] { ContactsContract.Groups._ID,
				ContactsContract.Groups.ACCOUNT_NAME,
				ContactsContract.Groups.ACCOUNT_TYPE,
				ContactsContract.Groups.TITLE, };
		String selection = null;
		String[] selectionArgs = null;
		String sortOrder = ContactsContract.Groups.TITLE
				+ " COLLATE LOCALIZED ASC"; 
		CursorLoader loader = new CursorLoader(context, uri, projection,
				selection, selectionArgs, sortOrder);
		Cursor cursor = null;
		boolean foundStarredGroup = false;
		boolean foundMyContacts = false;
		try {
			loader.startLoading();
			cursor = loader.loadInBackground();
			if (cursor == null) {
				return groups;
			}
			cursor.moveToFirst();
			while (cursor.isAfterLast() == false) {
				long groupId = cursor.getLong(0);
				String accountName = cursor.getString(1);
				String accountType = cursor.getString(2);
				String title = cursor.getString(3);
				if (title == null || title.equalsIgnoreCase(myContacts)) { 
					if (foundMyContacts) {
						cursor.moveToNext();
						continue;
					}
					foundMyContacts = true;
					groupId = ContactsWidgetConfigurationActivity.CONTACT_MY_CONTACTS_GROUP_ID;
					title = myContacts;
				} else if (title.equalsIgnoreCase(starredContacts)
						|| STARRED_CONTACTS_ENG.equalsIgnoreCase(title)) {
					foundStarredGroup = true;
					groupId = ContactsWidgetConfigurationActivity.CONTACT_STARRED_GROUP_ID;
				}
				ContactGroup group = new ContactGroup(groupId, accountName,
						accountType, title);
				groups.add(group);
				cursor.moveToNext();
			}
		} finally {
			loader.stopLoading();
			if (cursor != null) {
				cursor.close();
			}
		}
		if (!foundStarredGroup) {
			ContactGroup group = new ContactGroup(
					ContactsWidgetConfigurationActivity.CONTACT_STARRED_GROUP_ID, starredContacts,
					null, starredContacts);
			groups.add(group);
		}
		if (!foundMyContacts) {
			ContactGroup group = new ContactGroup(
					ContactsWidgetConfigurationActivity.CONTACT_MY_CONTACTS_GROUP_ID, myContacts,
					null, myContacts);
			groups.add(group);
		}
		return groups;
	}
