本文整理匯總了Java中android.provider.ContactsContract.Data.MIMETYPE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Data.MIMETYPE屬性的具體用法?Java Data.MIMETYPE怎麽用?Java Data.MIMETYPE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.provider.ContactsContract.Data
的用法示例。
在下文中一共展示了Data.MIMETYPE屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getGroupIdByContactId
/**
* ������ϵ��ID��ȡ��ϵ������Ⱥ��
*
* @param contactId
* ��ϵ��ID
* @return
*/
public int getGroupIdByContactId(int contactId) {
Uri uri = ContactsContract.Data.CONTENT_URI;
String[] RAW_PROJECTION = new String[] { Data.MIMETYPE, Data.DATA1 };
Cursor cursor = context.getContentResolver().query(uri, RAW_PROJECTION,
Data.RAW_CONTACT_ID + "=?", new String[] { contactId + "" },
null);
int groupId = 0;
while (cursor.moveToNext()) {
String mime = cursor.getString(cursor.getColumnIndex("mimetype"));
if ("vnd.android.cursor.item/group_membership".equals(mime)) {
groupId = cursor.getInt(cursor.getColumnIndex("data1"));
}
}
cursor.close();
return groupId;
}
示例2: updatePhoto
private boolean updatePhoto(ContactStruct contact, String rawContactId, Context ctx) {
// overwrite existing
String[] proj = new String[] {
Photo.RAW_CONTACT_ID, Data.MIMETYPE, Photo.PHOTO
};
String where = Photo.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=? AND " + Photo.PHOTO
+ "!=NULL";
String[] args = new String[] {
rawContactId, Photo.CONTENT_ITEM_TYPE
};
ContentValues values = valuesPhoto(contact);
values.put(Photo.RAW_CONTACT_ID, rawContactId);
return updateDataRow(ctx, proj, where, args, values);
}
示例3: updateUrl
private boolean updateUrl(ContactMethod cmethod, String rawContactId, Context ctx) {
// seek for raw contact + url = same
String[] proj = new String[] {
Website.RAW_CONTACT_ID, Data.MIMETYPE, Website.DATA
};
String where = Website.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=? AND "
+ Website.DATA + "=?";
String[] args = new String[] {
rawContactId, Website.CONTENT_ITEM_TYPE, cmethod.data
};
ContentValues values = valuesUrl(cmethod);
values.put(Website.RAW_CONTACT_ID, rawContactId);
return updateDataRow(ctx, proj, where, args, values);
}
示例4: updateEmail
private boolean updateEmail(ContactMethod cmethod, String rawContactId, Context ctx) {
// seek for raw contact + email = same
String[] proj = new String[] {
Email.RAW_CONTACT_ID, Data.MIMETYPE, Email.DATA
};
String where = Email.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=? AND " + Email.DATA
+ "=?";
String[] args = new String[] {
rawContactId, Email.CONTENT_ITEM_TYPE, cmethod.data
};
ContentValues values = valuesEmail(cmethod);
values.put(Email.RAW_CONTACT_ID, rawContactId);
return updateDataRow(ctx, proj, where, args, values);
}
示例5: updateOrg
private boolean updateOrg(OrganizationData org, String rawContactId, Context ctx) {
// seek for raw contact + company + title = same
String[] proj = new String[] {
Organization.RAW_CONTACT_ID, Data.MIMETYPE, Organization.COMPANY,
Organization.TITLE
};
String where = Organization.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=? AND ("
+ Organization.COMPANY + "=? OR " + Organization.TITLE + "=?)";
String[] args = new String[] {
rawContactId, Organization.CONTENT_ITEM_TYPE, org.companyName, org.positionName
};
ContentValues values = valuesOrg(org);
values.put(Organization.RAW_CONTACT_ID, rawContactId);
return updateDataRow(ctx, proj, where, args, values);
}
示例6: updatePostal
private boolean updatePostal(Address postal, String rawContactId, Context ctx) {
// seek for raw contact + formatted address = same
String[] proj = new String[] {
StructuredPostal.RAW_CONTACT_ID, Data.MIMETYPE, StructuredPostal.FORMATTED_ADDRESS
};
String where = StructuredPostal.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=? AND "
+ StructuredPostal.FORMATTED_ADDRESS + "=?";
String[] args = new String[] {
rawContactId, StructuredPostal.CONTENT_ITEM_TYPE, postal.toString()
};
ContentValues values = valuesPostal(postal);
values.put(StructuredPostal.RAW_CONTACT_ID, rawContactId);
return updateDataRow(ctx, proj, where, args, values);
}
示例7: updatePhone
private boolean updatePhone(PhoneData phone, String rawContactId, Context ctx) {
// seek for raw contact + number = same
String[] proj = new String[] {
Phone.RAW_CONTACT_ID, Data.MIMETYPE, Phone.NUMBER
};
String where = Phone.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=? AND " + Phone.NUMBER
+ "=?";
String[] args = new String[] {
rawContactId, Phone.CONTENT_ITEM_TYPE, phone.data
};
ContentValues values = valuesPhone(phone);
values.put(Phone.RAW_CONTACT_ID, rawContactId);
return updateDataRow(ctx, proj, where, args, values);
}
示例8: getContactsFacebookIds
private static Set<String> getContactsFacebookIds(final Activity activity) {
Set<String> FacebookIds = new HashSet<String>();
String selection = Data.MIMETYPE + " = ? "
+ " AND " + Data.DATA6 + " = ?";
String[] selectionArgs = {
ContactsContract.CommonDataKinds.Im.CONTENT_ITEM_TYPE,
Settings.Contacts.DataKinds.Facebook.CUSTOM_NAME
};
Cursor cursor = activity.getContentResolver().query(Data.CONTENT_URI,
new String[]{Data.DATA10},
selection,
selectionArgs,
null);
while (cursor.moveToNext()) {
FacebookIds.add(cursor.getString(0));
}
return FacebookIds;
}
示例9: getContactsCursor
private Cursor getContactsCursor(ContentResolver cr) {
String req = "(" + Data.MIMETYPE + " = '" + CommonDataKinds.Phone.CONTENT_ITEM_TYPE
+ "' AND " + CommonDataKinds.Phone.NUMBER + " IS NOT NULL "
+ " OR (" + Data.MIMETYPE + " = '" + CommonDataKinds.SipAddress.CONTENT_ITEM_TYPE
+ "' AND " + CommonDataKinds.SipAddress.SIP_ADDRESS + " IS NOT NULL))";
String[] projection = new String[] { Data.CONTACT_ID, Data.DISPLAY_NAME };
String query = Data.DISPLAY_NAME + " IS NOT NULL AND (" + req + ")";
Cursor cursor = cr.query(Data.CONTENT_URI, projection, query, null, " lower(" + Data.DISPLAY_NAME + ") COLLATE UNICODE ASC");
if (cursor == null) {
return cursor;
}
MatrixCursor result = new MatrixCursor(cursor.getColumnNames());
Set<String> groupBy = new HashSet<String>();
while (cursor.moveToNext()) {
String name = cursor.getString(cursor.getColumnIndex(Data.DISPLAY_NAME));
if (!groupBy.contains(name)) {
groupBy.add(name);
Object[] newRow = new Object[cursor.getColumnCount()];
int contactID = cursor.getColumnIndex(Data.CONTACT_ID);
int displayName = cursor.getColumnIndex(Data.DISPLAY_NAME);
newRow[contactID] = cursor.getString(contactID);
newRow[displayName] = cursor.getString(displayName);
result.addRow(newRow);
}
}
cursor.close();
return result;
}
示例10: getCSipPhonesContact
@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;
}
示例11: getDataProjection
/**
* Get the DATA_PROJECTION for ContactPicker and PhoneNumberPicker.
*/
public static String[] getDataProjection() {
String[] dataProjection = {
Data.MIMETYPE,
Email.ADDRESS,
Email.TYPE,
Phone.NUMBER,
Phone.TYPE,
};
return dataProjection;
}
示例12: getEmailAdapterProjection
/**
* Get the NEW_PROJECTION for EmailAddressAdapter.
*/
public static String[] getEmailAdapterProjection() {
String[] emailAdapterProjection = {
Data._ID,
Data.DISPLAY_NAME,
Email.ADDRESS,
Data.MIMETYPE,
};
return emailAdapterProjection;
}
示例13: getAllColumns
private String[] getAllColumns() {
return new String[] {Entity.DATA_ID, Data.MIMETYPE, Data.IS_SUPER_PRIMARY,
Data.DATA1, Data.DATA2, Data.DATA3, Data.DATA4,
Data.DATA5, Data.DATA6, Data.DATA7, Data.DATA8,
Data.DATA9, Data.DATA10, Data.DATA11, Data.DATA12,
Data.DATA13, Data.DATA14, Data.DATA15};
}
示例14: getContactName
/**
* Retrieve a user's application key, based on the key name.
*/
protected String getContactName(String contactLookupKey) {
String name = "";
if (!SafeSlinger.doesUserHavePermission(Manifest.permission.READ_CONTACTS)) {
return null;
}
if (TextUtils.isEmpty(contactLookupKey)) {
return null;
}
String where = Data.MIMETYPE + " = ?";
String[] whereParameters = new String[] {
StructuredName.CONTENT_ITEM_TYPE
};
Uri dataUri = getDataUri(contactLookupKey);
if (dataUri != null) {
Cursor c = getContentResolver().query(dataUri, null, where, whereParameters, null);
if (c != null) {
try {
if (c.moveToFirst()) {
do {
String newname = c.getString(c
.getColumnIndexOrThrow(StructuredName.DISPLAY_NAME));
boolean super_primary = (c.getInt(c
.getColumnIndexOrThrow(StructuredName.IS_SUPER_PRIMARY)) != 0);
if ((TextUtils.isEmpty(name) || super_primary)) {
name = newname;
}
} while (c.moveToNext());
}
} finally {
c.close();
}
}
}
return TextUtils.isEmpty(name) ? null : name;
}
示例15: getContactPhoto
/**
* Retrieve a user's photo.
*/
protected byte[] getContactPhoto(String contactLookupKey) {
byte[] photo = null;
if (!SafeSlinger.doesUserHavePermission(Manifest.permission.READ_CONTACTS)) {
return photo;
}
if (TextUtils.isEmpty(contactLookupKey)) {
return photo;
}
String where = Data.MIMETYPE + " = ?";
String[] whereParameters = new String[] {
Photo.CONTENT_ITEM_TYPE
};
Uri dataUri = getDataUri(contactLookupKey);
if (dataUri != null) {
Cursor c = getContentResolver().query(dataUri, null, where, whereParameters, null);
if (c != null) {
try {
if (c.moveToFirst()) {
do {
byte[] newphoto = c.getBlob(c.getColumnIndexOrThrow(Photo.PHOTO));
boolean super_primary = (c.getInt(c
.getColumnIndexOrThrow(Photo.IS_SUPER_PRIMARY)) != 0);
if (newphoto != null && (photo == null || super_primary)) {
photo = newphoto;
}
} while (c.moveToNext());
}
} finally {
c.close();
}
}
}
return photo;
}