I want to fetch all contact data including all raw contacts. I referred this link
and this is the code that i am using :
Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, Long.valueOf(raw_contact_id));
Uri entityUri = Uri.withAppendedPath(rawContactUri, Entity.CONTENT_DIRECTORY);
Cursor c = getContentResolver().query(entityUri,
new String[] { RawContacts.SOURCE_ID, Entity.DATA_ID, Entity.MIMETYPE, Entity.DATA1,
Entity.DATA2, Entity.DATA3, Entity.DATA4, Entity.DATA5, Entity.DATA6, Entity.DATA7,
Entity.DATA8, Entity.DATA9, Entity.DATA10, Entity.DATA11, Entity.DATA12, Entity.DATA13,
Entity.DATA14/* , Entity.DATA15 */ },
null, null, null);
try {
while (c.moveToNext()) {
String sourceId = c.getString(0);
if (!c.isNull(1)) {
String mimeType = c.getString(2);
// if (!mimeType.contains("photo")) {
String data1 = c.getString(3);
String data2 = c.getString(4);
String data3 = c.getString(5);
String data4 = c.getString(6);
}
}
} finally {
c.close();
}
The problem is that the implementation of this code takes a lot of time to fetch all contacts-data.
Is there any other way to get the contacts-data in under 5 seconds.