views:

14

answers:

1

When picking out contact details, is there a built in domain class they can be mapped to? Or, do you have to create your own?

For example I do the following :

ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
        null, null, null, null);
String s = null;
if (cursor.getCount() > 0)
{
    while (cursor.moveToNext())
    {
        s = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
    }
}

With s, can I put that into a "contact" object/domain class, perhaps something like :

Contact myContact = new Contact();
myContact.setName(s);
+1  A: 

AFAIK There is no built in Contacts class, besides with extensible Contacts model in android it will soon become a Bean around CommonDataKinds plus Map for everything else, besides I believe it's also true for the most of data provided by Android SDK They give you access to Data how you handle it is yours choice

Nikolay Ivanov