本文整理汇总了Java中android.provider.ContactsContract.CommonDataKinds.Photo类的典型用法代码示例。如果您正苦于以下问题:Java Photo类的具体用法?Java Photo怎么用?Java Photo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Photo类属于android.provider.ContactsContract.CommonDataKinds包,在下文中一共展示了Photo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: loadContact2
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
public static List<ContactEntity> loadContact2(Context context){
List<ContactEntity> contacts=new ArrayList<ContactEntity>();
ContentResolver cr=context.getContentResolver();
String [] projection={Phone.DISPLAY_NAME,Phone.NUMBER,Photo.PHOTO_ID,Phone.CONTACT_ID};
Cursor c=cr.query(Phone.CONTENT_URI, projection, null, null, null);
if(c!=null){
while(c.moveToNext()){
String name=c.getString(0);
String number=c.getString(1);
long contactId=c.getLong(3);
long photoId=c.getLong(2);
Bitmap bitmap=null;
if(photoId>0){
Uri uri=ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, contactId);
InputStream input=ContactsContract.Contacts.openContactPhotoInputStream(cr, uri);
bitmap=BitmapFactory.decodeStream(input);
}
ContactEntity entity=new ContactEntity();
entity.setName(name);
entity.setNumber(number);
entity.setBitmap(bitmap);
contacts.add(entity);
}
}
c.close();
return contacts;
}
开发者ID:Lux1041,项目名称:Contacts,代码行数:28,代码来源:GetContactInfo.java
示例2: populatePhoto
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
protected void populatePhoto(Contact c) throws RemoteException {
@Cleanup Cursor cursor = providerClient.query(dataURI(),
new String[] { Photo.PHOTO_FILE_ID, Photo.PHOTO },
Photo.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=?",
new String[] { String.valueOf(c.getLocalID()), Photo.CONTENT_ITEM_TYPE }, null);
if (cursor != null && cursor.moveToNext()) {
if (!cursor.isNull(0)) {
Uri photoUri = Uri.withAppendedPath(
ContentUris.withAppendedId(RawContacts.CONTENT_URI, c.getLocalID()),
RawContacts.DisplayPhoto.CONTENT_DIRECTORY);
try {
@Cleanup AssetFileDescriptor fd = providerClient.openAssetFile(photoUri, "r");
@Cleanup InputStream is = fd.createInputStream();
c.setPhoto(IOUtils.toByteArray(is));
} catch(IOException ex) {
Log.w(TAG, "Couldn't read high-res contact photo", ex);
}
} else
c.setPhoto(cursor.getBlob(1));
}
}
开发者ID:eXfio,项目名称:CucumberSync,代码行数:22,代码来源:LocalAddressBook.java
示例3: populateEvents
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
protected void populateEvents(Contact c) throws RemoteException {
@Cleanup Cursor cursor = providerClient.query(dataURI(), new String[] { CommonDataKinds.Event.TYPE, CommonDataKinds.Event.START_DATE },
Photo.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=?",
new String[] { String.valueOf(c.getLocalID()), CommonDataKinds.Event.CONTENT_ITEM_TYPE }, null);
while (cursor != null && cursor.moveToNext()) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
try {
Date date = formatter.parse(cursor.getString(1));
switch (cursor.getInt(0)) {
case CommonDataKinds.Event.TYPE_ANNIVERSARY:
c.setAnniversary(new Anniversary(date));
break;
case CommonDataKinds.Event.TYPE_BIRTHDAY:
c.setBirthDay(new Birthday(date));
break;
}
} catch (ParseException e) {
Log.w(TAG, "Couldn't parse local birthday/anniversary date", e);
}
}
}
开发者ID:eXfio,项目名称:CucumberSync,代码行数:22,代码来源:LocalAddressBook.java
示例4: Assets
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
public Assets(Context context, long contactId) {
this.context = context;
cursor = context.getContentResolver().query(
Data.CONTENT_URI,
new String[]{Data._ID,
Data.RAW_CONTACT_ID, Data.MIMETYPE, Data.IS_PRIMARY,
Data.IS_SUPER_PRIMARY, Data.DATA_VERSION, 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, Data.SYNC1,
Data.SYNC2, Data.SYNC3, Data.SYNC4, },
Data.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + " IN ( ?, ?, ?, ?, ?, ? )",
new String[]{
String.valueOf(contactId),
Nickname.CONTENT_ITEM_TYPE,
Im.CONTENT_ITEM_TYPE,
Photo.CONTENT_ITEM_TYPE,
},
null);
//cursor.moveToFirst();
columnNames = cursor.getColumnNames();
}
开发者ID:emdete,项目名称:Simplicissimus,代码行数:23,代码来源:Assets.java
示例5: updatePhoto
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
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);
}
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:17,代码来源:ContactAccessorApi5.java
示例6: getContactsPhoto
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
/**
* gets the contact photo for the given contact id, if available
*
*/
private void getContactsPhoto(String contact_id) {
Uri photoUri = Data.CONTENT_URI;
String[] projection = new String[] { Photo.PHOTO, Data._ID, Data.CONTACT_ID };
String selection = Data.CONTACT_ID + " = " + contact_id;
Cursor cursor = cr.query(photoUri, projection, selection, null, null);
String filePath = dataPath + "contact_" + contact_id + ".jpg";
try {
while (cursor.moveToNext()) {
byte[] photo = cursor.getBlob(0);
if (photo != null) {
Bitmap photoBitmap = BitmapFactory.decodeByteArray(photo, 0, photo.length);
SDCardHandler.savePicture(filePath, photoBitmap);
}
}
} catch (IOException e) {
view.showIOError("contact picture");
} finally {
cursor.close();
}
}
开发者ID:j-koenig,项目名称:osaft,代码行数:25,代码来源:Gatherer.java
示例7: addAvatar
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
public ContactOperations addAvatar(String pageName, String avatarName) throws IOException {
if (!TextUtils.isEmpty(pageName) && !TextUtils.isEmpty(avatarName)) {
byte[] avatarBuffer = XWikiHttp.downloadImage(pageName, avatarName);
if (avatarBuffer != null) {
mValues.clear();
mValues.put(Photo.PHOTO, avatarBuffer);
mValues.put(Photo.MIMETYPE, Photo.CONTENT_ITEM_TYPE);
addInsertOp();
}
}
return this;
}
开发者ID:xwiki-contrib,项目名称:android-authenticator,代码行数:13,代码来源:ContactOperations.java
示例8: updateAvatar
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
public ContactOperations updateAvatar(String pageName, String avatarName, Uri uri) throws IOException {
if (!TextUtils.isEmpty(pageName) && !TextUtils.isEmpty(avatarName)) {
byte[] avatarBuffer = XWikiHttp.downloadImage(pageName, avatarName);
if (avatarBuffer != null) {
mValues.clear();
mValues.put(Photo.PHOTO, avatarBuffer);
mValues.put(Photo.MIMETYPE, Photo.CONTENT_ITEM_TYPE);
addUpdateOp(uri);
}
}
return this;
}
开发者ID:xwiki-contrib,项目名称:android-authenticator,代码行数:13,代码来源:ContactOperations.java
示例9: clearPhotoMetadata
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
/**
* Clears metadata about the original photo file.
*
* @param uri
*/
public ContactOperations clearPhotoMetadata(Uri uri) {
mValues.clear();
mValues.putNull(Photo.SYNC1);
mValues.putNull(Photo.SYNC2);
mValues.putNull(Photo.SYNC3);
addUpdateOp(uri);
return this;
}
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:14,代码来源:ContactOperations.java
示例10: updatePhotoHash
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
public ContactOperations updatePhotoHash(String hash, int version, Uri uri) {
mValues.clear();
// Hash
mValues.put(Photo.SYNC1, hash);
// Save Sync-Version (this modifications increments the version)
mValues.put(Photo.SYNC2, version);
addUpdateOp(uri);
return this;
}
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:10,代码来源:ContactOperations.java
示例11: setNewHashValue
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
/**
* Calculate New Hash Value of the current thumbnail.
*
* @param context
* @param rawContact
* @param batchOperation
* @param rawContactId
*/
private static void setNewHashValue(Context context,
BatchOperation batchOperation, long rawContactId) {
// get photo and set new hash and version, because thumbnail will be
// generated from the system.
// Read photo
final ContentResolver resolver = context.getContentResolver();
final Cursor c = resolver.query(DataQuery.CONTENT_URI,
DataQuery.PROJECTION, DataQuery.SELECTION_TYPE,
new String[] { String.valueOf(rawContactId),
Photo.CONTENT_ITEM_TYPE }, null);
try {
while (c.moveToNext()) {
byte[] photo = c.getBlob(DataQuery.COLUMN_PHOTO_IMAGE);
if (photo != null) {
// Generate Hash
Digest digest = new MD5Digest();
byte[] resBuf = new byte[digest.getDigestSize()];
digest.update(photo, 0, photo.length);
digest.doFinal(resBuf, 0);
String hash = Base64.encodeToString(resBuf, Base64.DEFAULT);
int currVersion = c.getInt(DataQuery.COLUMN_VERSION);
int newVersion = currVersion++;
// Set Hash
final ContactOperations contactOp = ContactOperations
.updateExistingContact(rawContactId, true,
batchOperation);
final long id = c.getLong(DataQuery.COLUMN_ID);
final Uri uri = ContentUris.withAppendedId(
Data.CONTENT_URI, id);
contactOp.updatePhotoHash(hash, newVersion, uri);
}
}
} finally {
c.close();
}
}
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:46,代码来源:ContactManager.java
示例12: deleteContact
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
/**
* Deletes a contact from the platform contacts provider. This method is
* used both for contacts that were deleted locally and then that deletion
* was synced to the server, and for contacts that were deleted on the
* server and the deletion was synced to the client.
*
* @param rawContactId
* the unique Id for this rawContact in contacts provider
*/
private static void deleteContact(Context context, long rawContactId,
BatchOperation batchOperation, String accountName) {
batchOperation.add(ContactOperations.newDeleteCpo(
ContentUris.withAppendedId(RawContacts.CONTENT_URI,
rawContactId), true, true).build());
final ContentResolver resolver = context.getContentResolver();
final Cursor c = resolver.query(DataQuery.CONTENT_URI,
DataQuery.PROJECTION, DataQuery.SELECTION_TYPE,
new String[] { String.valueOf(rawContactId),
Photo.CONTENT_ITEM_TYPE }, null);
while (c.moveToNext()) {
if (!c.isNull(DataQuery.COLUMN_SYNC3)) {
String fileName = c.getString(DataQuery.COLUMN_SYNC3);
// Delete old photo file.
File photoFile = PhotoHelper.getPhotoFile(context, fileName,
accountName);
if (photoFile.exists()) {
boolean deleted = photoFile.delete();
if (!deleted) {
LogHelper.logW(TAG, "Photo File could not be deleted:"
+ photoFile.getAbsolutePath());
}
}
}
}
}
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:38,代码来源:ContactManager.java
示例13: doInBackground
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
@Override
protected List doInBackground(String... params) {
Flickr flickr = new Flickr(FLICKR_API_KEY, FLICKR_FORMAT);
List photos = flickr.getPhotoSets().getPhotos(PHOTOSET_ID);
List result = new ArrayList();
totalCount = photos.size();
currentIndex = 0;
for (Photo photo : photos) {
currentIndex++;
List sizes = flickr.getPhotos().getSizes(photo.getId());
String thumbnailUrl = sizes.get(0).getSource();
String mediumUrl = sizes.get(4).getSource();
InputStream inputSteamThumbnail = null, inputStreamMedium=null;
try {
inputStreamThumbnail = new URL(thumbnailUrl).openStream();
inputStreamMedium = new URL(mediumUrl).openStream();
} catch (IOException e) {
e.printStackTrace();
}
Bitmap bitmapThumbnail = BitmapFactory.decodeStream(inputStreamThumbnail);
Bitmap bitmapMedium = BitmapFactory.decodeStream(inputStreamMedium);
result.add(new ImageInfo(photo.getTitle(),bitmapThumbnail ,bitmapMedium ));
publishProgress(currentIndex, totalCount);
}
currentAppData.setImageInfos(result);
return result;
}
开发者ID:avidas,项目名称:Android-PhotoBook,代码行数:29,代码来源:PhotoGridActivity.java
示例14: getContactPhoto
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
/**
* 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;
}
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:40,代码来源:BaseActivity.java
示例15: addPhoto
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
@Override
public boolean addPhoto(ContactStruct contact, Cursor photos) {
byte[] photo = photos.getBlob(photos.getColumnIndexOrThrow(Photo.PHOTO));
boolean super_primary = (photos.getInt(photos.getColumnIndex(Photo.IS_SUPER_PRIMARY)) != 0);
if (photo != null && isPhotoNew(contact, photo, super_primary)) {
contact.photoBytes = photo;
contact.photoType = null;
return true;
}
return false;
}
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:12,代码来源:ContactAccessorApi5.java
示例16: valuesPhoto
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
private ContentValues valuesPhoto(ContactStruct contact) {
ContentValues val = new ContentValues();
val.put(Data.MIMETYPE, Photo.CONTENT_ITEM_TYPE);
if (contact.photoBytes != null)
val.put(Photo.PHOTO, contact.photoBytes);
return val;
}
开发者ID:SafeSlingerProject,项目名称:SafeSlinger-Android,代码行数:8,代码来源:ContactAccessorApi5.java
示例17: getAvatar
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
@Override
public InputStream getAvatar( String email ) {
Cursor contact = search( email );
try {
if( contact.moveToFirst() ) {
int id = CursorUtils.getInt( contact, Contacts.PHOTO_ID );
Cursor photos = resolver.query( ContentUris.withAppendedId( Data.CONTENT_URI, id ), new String [] {
Photo.PHOTO
}, null, null, null );
try {
if( photos.moveToFirst() ) {
byte [] buffer = photos.getBlob( 0 );
return new ByteArrayInputStream( buffer );
}
} finally {
photos.close();
}
}
} finally {
contact.close();
}
return null;
}
开发者ID:SilentCircle,项目名称:silent-text-android,代码行数:28,代码来源:SystemContactRepository.java
示例18: addMultipleValueProperty
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
/**
* 为存在多值的域添加属性
*
* @param contactPropMap
* 包含联系人信息的 map
* @param logicParentField
* 域名
* @param ops
* ContentProviderOperation
*/
private void addMultipleValueProperty(Map<String, Object> contactPropMap,
String logicParentField, ArrayList<ContentProviderOperation> ops) {
String quantityField = generateQuantityFieldOf(logicParentField);
int quantity = (Integer) contactPropMap.get(quantityField);
if (quantity <= 0) {
return;
}
for (int i = 0; i < quantity; i++) {
ContentProviderOperation.Builder builder = ContentProviderOperation
.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(
ContactsContract.Data.RAW_CONTACT_ID, 0);
String contentItemType = LOGIC_FIELD_TO_CONTENT_TYPE_MAP
.get(logicParentField);
builder.withValue(ContactsContract.Data.MIMETYPE, contentItemType);
String commonValueFieldKey = generateSubFieldKey(logicParentField,
i, LOGIC_FIELD_COMMON_VALUE);
Object commonValue = contactPropMap.get(commonValueFieldKey);
// 如果ContactField中的value属性为null,则不保存该ContactField,不然部分手机在保存的时候会抛异常
if (isOnlyCommonSubFieldsIncluded(logicParentField)
&& null == commonValue) {
continue;
}
if (logicParentField == LOGIC_FIELD_PHOTOS) {
builder.withValue(ContactsContract.Data.IS_SUPER_PRIMARY, 1)
.withValue(Photo.PHOTO, commonValue);
} else {
setSubFieldValueToBuilder(builder, contactPropMap,
logicParentField, i);
}
ops.add(builder.build());
}
}
开发者ID:polyvi,项目名称:openxface-android,代码行数:46,代码来源:XContactAccessorAPILevel5Impl.java
示例19: addContact1
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
/**
* �����ϵ��
*
* @param contact
* ��ϵ��ʵ�����
* @param groupId
* ���
*/
public boolean addContact1(SortEntry contact, int groupId) {
if (TextUtils.isEmpty(contact.mName)) {
Toast.makeText(context, "����������", Toast.LENGTH_LONG).show();
return false;
}
ContentValues values = new ContentValues();
Uri rawContactUri = context.getContentResolver().insert(
RawContacts.CONTENT_URI, values);
int rawContactId = (int) ContentUris.parseId(rawContactUri);
// ��data���������
if (contact.mName != "") {
values.clear();
values.put(Data.RAW_CONTACT_ID, rawContactId);
values.put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);
values.put(StructuredName.GIVEN_NAME, contact.mName);
context.getContentResolver().insert(
ContactsContract.Data.CONTENT_URI,values);
}
// ��data�в���绰����
if (contact.mNum != "") {
values.clear();
String[] numbers = Tools.getPhoneNumber(contact.mNum);
for (int i = 0; i < numbers.length; i++) {
values.put(Data.RAW_CONTACT_ID, rawContactId);
values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
values.put(Phone.NUMBER, numbers[i]);
values.put(Phone.TYPE, Phone.TYPE_MOBILE);
context.getContentResolver().insert(
ContactsContract.Data.CONTENT_URI, values);
}
}
// ���ͷ��
if (contact.contactPhoto != null) {
values.clear();
values.put(Data.RAW_CONTACT_ID, rawContactId);
values.put(Data.MIMETYPE, Photo.CONTENT_ITEM_TYPE);
values.put(Photo.PHOTO,
ImageConvert.bitmapToByte(contact.contactPhoto));
context.getContentResolver().insert(
ContactsContract.Data.CONTENT_URI, values);
}
// // ��ӵ�ַ
// if (contact.getAddress() != "") {
// values.clear();
// values.put(Data.RAW_CONTACT_ID, rawContactId);
// values.put(Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE);
// values.put(SipAddress.CONTENT_ITEM_TYPE, contact.getAddress());
// context.getContentResolver().insert(
// ContactsContract.Data.CONTENT_URI, values);
// }
// // �������
// if (contact.getEmail() != "") {
// values.clear();
// values.put(Data.RAW_CONTACT_ID, rawContactId);
// values.put(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE);
// values.put(Email.CONTENT_ITEM_TYPE, contact.getEmail());
// context.getContentResolver().insert(
// ContactsContract.Data.CONTENT_URI, values);
// }
if (groupId != 0) {
new GroupDAO(context).addMemberToGroup(rawContactId, groupId);
}
return true;
}
开发者ID:nighthary,项目名称:phoneContact,代码行数:75,代码来源:ContactDAO.java
示例20: updataCotact
import android.provider.ContactsContract.CommonDataKinds.Photo; //导入依赖的package包/类
/**
* ������ϵ��
*
* @param rawContactId
* ��ϵ��id
*/
public void updataCotact(long rawContactId, SortEntry contact,
int old_groupID) {
ContentValues values = new ContentValues();
// ��������
values.put(StructuredName.GIVEN_NAME, contact.mName);
context.getContentResolver().update(
ContactsContract.Data.CONTENT_URI,
values,
Data.RAW_CONTACT_ID + "=? and " + Data.MIMETYPE + "=?",
new String[] { String.valueOf(rawContactId),
StructuredName.CONTENT_ITEM_TYPE });
// ���µ绰
if (contact.mNum != "") {
values.clear();
String[] numbers = Tools.getPhoneNumber(contact.mNum);
for (int i = 0; i < numbers.length; i++) {
values.put(Data.RAW_CONTACT_ID, rawContactId);
values.put(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
values.put(Phone.NUMBER, numbers[i]);
values.put(Phone.TYPE, Phone.TYPE_MOBILE);
// context.getContentResolver().insert(
// ContactsContract.Data.CONTENT_URI, values);
context.getContentResolver().update(ContactsContract.Data.CONTENT_URI,
values,
Data.RAW_CONTACT_ID+"=? and "+Data.MIMETYPE+"=?",
new String[]{String.valueOf(rawContactId),Phone.CONTENT_ITEM_TYPE});
}
}
// ����ͷ��
values.clear();
if (contact.contactPhoto != null) {
values.put(ContactsContract.CommonDataKinds.Photo.PHOTO,
ImageConvert.bitmapToByte(contact.contactPhoto));
context.getContentResolver().update(
ContactsContract.Data.CONTENT_URI,
values,
Data.RAW_CONTACT_ID + "=? and " + Data.MIMETYPE + " =?",
new String[] { String.valueOf(rawContactId),
Photo.CONTENT_ITEM_TYPE });
}
// ����Ⱥ��
if (contact.groupId != 0) {
values.clear();
values.put(
ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID,
contact.groupId);
context.getContentResolver().update(
ContactsContract.Data.CONTENT_URI,
values,
Data.RAW_CONTACT_ID + "=? and " + Data.MIMETYPE + " =?",
new String[] { String.valueOf(rawContactId),
GroupMembership.CONTENT_ITEM_TYPE });
} else {
new GroupDAO(context).deleteMemberFromGroup(
Integer.parseInt(contact.mID), old_groupID);
}
}
开发者ID:nighthary,项目名称:phoneContact,代码行数:65,代码来源:ContactDAO.java
注:本文中的android.provider.ContactsContract.CommonDataKinds.Photo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论