本文整理汇总了Java中android.provider.ContactsContract.Profile._ID属性的典型用法代码示例。如果您正苦于以下问题:Java Profile._ID属性的具体用法?Java Profile._ID怎么用?Java Profile._ID使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.ContactsContract.Profile
的用法示例。
在下文中一共展示了Profile._ID属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelfiUri
public static Uri getSelfiUri(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& context.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
return null;
}
String[] mProjection = new String[]{Profile._ID, Profile.PHOTO_URI};
Cursor mProfileCursor = context.getContentResolver().query(
Profile.CONTENT_URI, mProjection, null, null, null);
if (mProfileCursor == null || mProfileCursor.getCount() == 0) {
return null;
} else {
mProfileCursor.moveToFirst();
String uri = mProfileCursor.getString(1);
mProfileCursor.close();
if (uri == null) {
return null;
} else {
return Uri.parse(uri);
}
}
}
示例2: getSefliUri
public static Uri getSefliUri(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& context.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
return null;
}
String[] mProjection = new String[] { Profile._ID, Profile.PHOTO_URI };
Cursor mProfileCursor = context.getContentResolver().query(
Profile.CONTENT_URI, mProjection, null, null, null);
if (mProfileCursor == null || mProfileCursor.getCount() == 0) {
return null;
} else {
mProfileCursor.moveToFirst();
String uri = mProfileCursor.getString(1);
mProfileCursor.close();
if (uri == null) {
return null;
} else {
return Uri.parse(uri);
}
}
}
示例3: getProfilePictureUri
public static Uri getProfilePictureUri(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
return null;
}
final String[] projection = new String[]{Profile._ID, Profile.PHOTO_URI};
final Cursor cursor;
try {
cursor = context.getContentResolver().query(Profile.CONTENT_URI, projection, null, null, null);
} catch (SecurityException e) {
return null;
}
if (cursor == null) {
return null;
}
final String uri = cursor.moveToFirst() ? cursor.getString(1) : null;
cursor.close();
return uri == null ? null : Uri.parse(uri);
}
示例4: getProfilePictureUri
public static Uri getProfilePictureUri(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
return null;
}
final String[] projection = new String[]{Profile._ID, Profile.PHOTO_URI};
final Cursor cursor;
try {
cursor = context.getContentResolver().query(Profile.CONTENT_URI, projection, null, null, null);
} catch (SecurityException e) {
return null;
}
if (cursor == null) {
return null;
}
final String uri = cursor.moveToFirst() ? cursor.getString(1) : null;
cursor.close();
return uri == null ? null : Uri.parse(uri);
}
示例5: getSefliUri
public static Uri getSefliUri(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
&& context.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
return null;
}
String[] mProjection = new String[]{Profile._ID, Profile.PHOTO_URI};
Cursor mProfileCursor = context.getContentResolver().query(
Profile.CONTENT_URI, mProjection, null, null, null);
if (mProfileCursor == null || mProfileCursor.getCount() == 0) {
return null;
} else {
mProfileCursor.moveToFirst();
String uri = mProfileCursor.getString(1);
mProfileCursor.close();
if (uri == null) {
return null;
} else {
return Uri.parse(uri);
}
}
}
示例6: getSefliUri
public static Uri getSefliUri(Context context) {
String[] mProjection = new String[] { Profile._ID, Profile.PHOTO_URI };
Cursor mProfileCursor = context.getContentResolver().query(
Profile.CONTENT_URI, mProjection, null, null, null);
if (mProfileCursor == null || mProfileCursor.getCount() == 0) {
return null;
} else {
mProfileCursor.moveToFirst();
String uri = mProfileCursor.getString(1);
mProfileCursor.close();
if (uri == null) {
return null;
} else {
return Uri.parse(uri);
}
}
}
示例7: getSefliUri
public static Uri getSefliUri(Context context) {
String[] mProjection = new String[] { Profile._ID,
Profile.PHOTO_THUMBNAIL_URI };
Cursor mProfileCursor = context.getContentResolver().query(
Profile.CONTENT_URI, mProjection, null, null, null);
if (mProfileCursor.getCount() == 0) {
return null;
} else {
mProfileCursor.moveToFirst();
String uri = mProfileCursor.getString(1);
if (uri == null) {
return null;
} else {
return Uri.parse(uri);
}
}
}
示例8: findSelfInfo
@Override
public CallerInfo findSelfInfo(Context ctxt) {
CallerInfo callerInfo = new CallerInfo();
String[] projection = new String[] {
Profile._ID,
Profile.DISPLAY_NAME,
Profile.PHOTO_ID,
Profile.PHOTO_URI
};
Cursor cursor = ctxt.getContentResolver().query(Profile.CONTENT_URI, projection, null, null, null);
if(cursor != null) {
try {
if(cursor.getCount() > 0) {
cursor.moveToFirst();
ContentValues cv = new ContentValues();
DatabaseUtils.cursorRowToContentValues(cursor, cv);
callerInfo.contactExists = true;
if(cv.containsKey(Profile.DISPLAY_NAME) ) {
callerInfo.name = cv.getAsString(Profile.DISPLAY_NAME);
}
if(cv.containsKey(Profile._ID) ) {
callerInfo.personId = cv.getAsLong(Profile._ID);
callerInfo.contactContentUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, callerInfo.personId);
}
if(cv.containsKey(Profile.PHOTO_ID)) {
Long photoId = cv.getAsLong(Profile.PHOTO_ID);
if(photoId != null) {
callerInfo.photoId = photoId;
}
}
if(cv.containsKey(Profile.PHOTO_URI)) {
String photoUri = cv.getAsString(Profile.PHOTO_URI);
if(!TextUtils.isEmpty(photoUri)) {
callerInfo.photoUri = Uri.parse(photoUri);
}
}
if(callerInfo.name != null && callerInfo.name.length() == 0) {
callerInfo.name = null;
}
}
}catch(Exception e) {
Log.e(THIS_FILE, "Exception while retrieving cursor infos", e);
}finally {
cursor.close();
}
}
return callerInfo;
}