问下安卓的分享功能,代码怎么写?

上海程序员3 2013-11-27 03:56:11
问下安卓的分享功能,代码怎么写?
...全文
266 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
依然绿茶 2013-11-27
  • 打赏
  • 举报
回复
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();
                }
联系人的分享代码。
Ada168855 2013-11-27
  • 打赏
  • 举报
回复
有很多第三方提供的接口,你可以去百度一下
DrSmart 2013-11-27
  • 打赏
  • 举报
回复
尽量用官方的吧,各个分项的都有sdk例子的
-仅此而已 2013-11-27
  • 打赏
  • 举报
回复
http://dev.umeng.com/social/android/share/quick-integration友盟的快速分享 但是我基础差 还没实现 你若实现了 指点下

80,350

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧