Hey!
I'd like to query the contacts and create an RDF model (FOAF to be
exact) from the data received.
Therefore it would be necessary to know what kind of data I'm dealing
with.
I'll need the following information about each contact: name, phone
number(s), email address(es), IM ID(s) + corresponding IM service.
I thought that the best way to get this information was via the
ContactsContract.Data table.
So my query looks like this:
<code>
Uri contactsURI = ContactsContract.Data.CONTENT_URI;
String[] projection = new String[] {
ContactsContract.Data._ID,
ContactsContract.Data.CONTACT_ID,
ContactsContract.Data.DATA1,
ContactsContract.Data.DATA_VERSION
};
String where = ContactsContract.Data.MIMETYPE + " = ? OR " +
ContactsContract.Data.MIMETYPE
+ " = ? OR " +
ContactsContract.Data.MIMETYPE
+ " = ? OR " +
ContactsContract.Data.MIMETYPE
+ " = ?";
String[] whereArgs = new String[] {
ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE,
ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE
};
Cursor contactsTable = managedQuery(contactsURI, projection,
where,
whereArgs, null);
</code>
(I need the DATA_VERSION to know if updating the model is necessary.)
Now I'd like to go through the table and add properties to my model
for each entry. Therefore I'd need to know if the row I'm currently
reading contains a name, an email address, a phone number or an IM ID
(it would be best if I could also get information about the IM service
the ID belongs to).
Is it possible to get the CONTENT_ITEM_TYPE or anything like that? Or
should I perform a single query for each type and then connect the
information via the CONTACT_ID?
Thanks for your help and time!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en