当前位置: 首页>>代码示例>>Java>>正文


Java Profile._ID属性代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:22,代码来源:PhoneHelper.java

示例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);
		}
	}
}
 
开发者ID:xavierle,项目名称:messengerxmpp,代码行数:22,代码来源:PhoneHelper.java

示例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);
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:19,代码来源:PhoneHelper.java

示例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);
}
 
开发者ID:siacs,项目名称:Conversations,代码行数:18,代码来源:PhoneHelper.java

示例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);
		}
	}
}
 
开发者ID:Frozenbox,项目名称:frozenchat,代码行数:22,代码来源:PhoneHelper.java

示例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);
		}
	}
}
 
开发者ID:juanignaciomolina,项目名称:txtr,代码行数:18,代码来源:PhoneHelper.java

示例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);
		}
	}
}
 
开发者ID:GitESS,项目名称:SyncChatAndroid,代码行数:18,代码来源:PhoneHelper.java

示例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;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:60,代码来源:ContactsUtils14.java


注:本文中的android.provider.ContactsContract.Profile._ID属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。