private Cursor getGroupContacts(String groupName) {
ArrayListCursor groupCursor = null;
ArrayList<ArrayList<Object>> wrap=null;
ArrayList<Object> result =null;
Cursor cursor = mContext.getContentResolver().query(Groups.CONTENT_URI,
new String[] { Groups._ID, Groups.TITLE }, Groups.TITLE + " like ?",
new String[] { groupName }, null);
if (cursor != null && cursor.moveToFirst()) {
wrap = new ArrayList<ArrayList<Object>>();
result = null;
do {
result = new ArrayList<Object>();
result = new ArrayList<Object>();
result.add(cursor.getLong(cursor.getColumnIndex(Groups._ID))); // GROUP ID
result.add(cursor.getLong(cursor.getColumnIndex(Groups._ID))); // GROUP ID
result.add(cursor.getString(cursor.getColumnIndex(Groups.TITLE))); // NAME
result.add(GROUP_LABEL); // DATA
result.add(""); // MIMETYPE
result.add(""); // PHONE_TYPE
result.add(""); // PHONE_LABEL
wrap.add(result);
} while (cursor.moveToNext());
cursor.close();
groupCursor = new ArrayListCursor(PROJECTION_PHONE, wrap);
}
- I have used the above code to query the group contacts but i get more than one groups with same name . Unable to find out how some one please help me.
0 comments:
Post a Comment