Java Code Examples for android.provider.ContactsContract.Data#CONTENT_URI

The following examples show how to use android.provider.ContactsContract.Data#CONTENT_URI . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContactsUtils5.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<String> getCSipPhonesContact(Context ctxt, Long contactId) {
    ArrayList<String> results = new ArrayList<String>();
    Uri dataUri = Data.CONTENT_URI;
    String dataQuery = Data.MIMETYPE + "='" + CommonDataKinds.Im.CONTENT_ITEM_TYPE + "' "
            + " AND "
            + CommonDataKinds.Im.PROTOCOL + "=" + CommonDataKinds.Im.PROTOCOL_CUSTOM
            + " AND "
            + " LOWER(" + CommonDataKinds.Im.CUSTOM_PROTOCOL + ")='"+SipManager.PROTOCOL_CSIP+"'";
    // get csip data
    Cursor dataCursor = ctxt.getContentResolver()
            .query(dataUri,
                    new String[] {
                            CommonDataKinds.Im._ID,
                            CommonDataKinds.Im.DATA,
                    },
                    dataQuery + " AND " + CommonDataKinds.Im.CONTACT_ID + "=?",
                    new String[] {
                        Long.toString(contactId)
                    }, null);

    try {
        if (dataCursor != null && dataCursor.getCount() > 0) {
            dataCursor.moveToFirst();
            String val = dataCursor.getString(dataCursor
                    .getColumnIndex(CommonDataKinds.Im.DATA));
            if (!TextUtils.isEmpty(val)) {
                results.add(val);
            }
        }
    } catch (Exception e) {
        Log.e(THIS_FILE, "Error while looping on data", e);
    } finally {
        dataCursor.close();
    }
    
    return results;
}
 
Example 2
Source File: FavoritesFragmentContainer2.java    From Contacts with MIT License 5 votes vote down vote up
@Override
protected Uri getUri()
{
	Uri uri = Data.CONTENT_URI;

	if (isFilterQuery())
	{
		uri = Uri.withAppendedPath(Data.CONTENT_URI, mSearchQuery);
	}

	return uri;
}
 
Example 3
Source File: FavoritesFragmentContainer.java    From Contacts with MIT License 5 votes vote down vote up
@Override
protected Uri getUri()
{
	if (mPosition > 0)
		return Data.CONTENT_URI;
	
	return super.getUri();
}
 
Example 4
Source File: HoneycombMR1Util.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
/**
 * Get Data.CONTENT_URI for EmailAddressAdapter.
 */
public static Uri getDataContentUri() {
  return Data.CONTENT_URI;
}