Code example for Cursor

Methods: getColumnIndexOrThrowgetLonggetString

0
 
    return null; 
  } 
 
  public GroupData getGroupData(Context context, Cursor cursor) {
    long id      = cursor.getLong(cursor.getColumnIndexOrThrow(ContactsContract.Groups._ID));
    String title = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Groups.TITLE));
 
    return new GroupData(id, title);
  } 
 
  public ContactData getContactData(Context context, Cursor cursor) {
    return getContactData(context,
                          cursor.getString(cursor.getColumnIndexOrThrow(Contacts.DISPLAY_NAME)),
                          cursor.getLong(cursor.getColumnIndexOrThrow(Contacts._ID)));
} 
 
  private ContactData getContactData(Context context, String displayName, long id) {
    ContactData contactData = new ContactData(id, displayName);
    Cursor numberCursor     = null;