80,350
社区成员
发帖
与我相关
我的任务
分享
final String lookupKey = mContactData.getLookupKey();
Uri shareUri = Uri.withAppendedPath(Contacts.CONTENT_VCARD_URI, lookupKey);
if (mContactData.isUserProfile()) {
// User is sharing the profile. We don't want to force the receiver to have
// the highly-privileged READ_PROFILE permission, so we need to request a
// pre-authorized URI from the provider.
shareUri = getPreAuthorizedUri(shareUri);
}
final Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType(Contacts.CONTENT_VCARD_TYPE);
intent.putExtra(Intent.EXTRA_STREAM, shareUri);
// Launch chooser to share contact via
final CharSequence chooseTitle = mContext.getText(R.string.share_via);
final Intent chooseIntent = Intent.createChooser(intent, chooseTitle);
try {
mContext.startActivity(chooseIntent);
} catch (ActivityNotFoundException ex) {
Toast.makeText(mContext, R.string.share_error, Toast.LENGTH_SHORT).show();
}
联系人的分享代码。