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


Java WeiXinShareContent.setShareImage方法代码示例

本文整理汇总了Java中com.umeng.socialize.weixin.media.WeiXinShareContent.setShareImage方法的典型用法代码示例。如果您正苦于以下问题:Java WeiXinShareContent.setShareImage方法的具体用法?Java WeiXinShareContent.setShareImage怎么用?Java WeiXinShareContent.setShareImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.umeng.socialize.weixin.media.WeiXinShareContent的用法示例。


在下文中一共展示了WeiXinShareContent.setShareImage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setWeixinContent

import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入方法依赖的package包/类
public void setWeixinContent(String title, String desc, String contentUrl, UMImage image) {
    WeiXinShareContent weixinContent = new WeiXinShareContent();
    weixinContent.setShareContent(desc);
    weixinContent.setTitle(title);
    weixinContent.setTargetUrl(contentUrl);
    weixinContent.setShareImage(image);
    mController.setShareMedia(weixinContent);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:ShareHelper.java

示例2: initSocial

import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入方法依赖的package包/类
protected  void initSocial(){
    mShareController.getConfig().removePlatform(SHARE_MEDIA.RENREN,
            SHARE_MEDIA.DOUBAN, SHARE_MEDIA.QZONE, SHARE_MEDIA.SINA,
            SHARE_MEDIA.TENCENT);
    //设置新浪SSO handler
    mShareController.getConfig().setSsoHandler(new SinaSsoHandler());
    String appId = AppContext.getInstance().getMetaData("WEIXIN_ID");
    String appSecret = AppContext.getInstance().getMetaData("WEIXIN_SECRET");
    // 添加微信平台
    UMWXHandler wxHandler = new UMWXHandler(this, appId, appSecret);
    wxHandler.addToSocialSDK();
    // 设置微信朋友分享内容
    WeiXinShareContent weiXinShareContent = new WeiXinShareContent();
    weiXinShareContent.setShareContent(AppContext.getInstance().getString(R.string.string_share_content));
    weiXinShareContent.setTitle(AppContext.getInstance().getString(R.string.string_share_content));
    weiXinShareContent.setShareImage(new UMImage(this, ImageUtils.drawableToBitamp(this, R.drawable.ic_logo)));
    weiXinShareContent.setTargetUrl(BaseClient.URL_USER_ABOUT);
    mShareController.setShareMedia(weiXinShareContent);
    // 添加微信朋友圈
    UMWXHandler wxCircleHandler = new UMWXHandler(this, appId, appSecret);
    wxCircleHandler.setToCircle(true);
    wxCircleHandler.addToSocialSDK();
    // 设置微信朋友圈分享内容
    CircleShareContent circleMedia = new CircleShareContent();
    circleMedia.setShareContent(AppContext.getInstance().getString(R.string.string_share_content));
    circleMedia.setTitle(AppContext.getInstance().getString(R.string.string_share_content));
    circleMedia.setShareImage(new UMImage(this, ImageUtils.drawableToBitamp(this, R.drawable.ic_logo)));
    circleMedia.setTargetUrl(BaseClient.URL_USER_ABOUT);
    // 设置分享内容
    mShareController.setShareMedia(circleMedia);
}
 
开发者ID:huijimuhe,项目名称:monolog-android,代码行数:32,代码来源:AbstractActivity.java

示例3: shareToWeiChat

import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入方法依赖的package包/类
private void shareToWeiChat() {
    // 添加微信平台
    UMWXHandler wxHandler = new UMWXHandler(getActivity(),
            Constants.WEICHAT_APPID, Constants.WEICHAT_SECRET);
    wxHandler.addToSocialSDK();
    // 设置微信好友分享内容
    WeiXinShareContent weixinContent = new WeiXinShareContent();
    // 设置分享文字
    weixinContent.setShareContent(getShareContent());
    // 设置title
    weixinContent.setTitle(getShareTitle());
    // 设置分享内容跳转URL
    weixinContent.setTargetUrl(getShareUrl());
    // 设置分享图片
    weixinContent.setShareImage(new UMImage(getActivity(), R.drawable.ima_app_icon));
    mController.setShareMedia(weixinContent);
    mController.postShare(getActivity(), SHARE_MEDIA.WEIXIN,
            new SnsPostListener() {

                @Override
                public void onStart() {
                    AppContext.showToastShort(R.string.tip_start_share);
                }

                @Override
                public void onComplete(SHARE_MEDIA arg0, int arg1,
                                       SocializeEntity arg2) {
                    AppContext.showToastShort(R.string.tip_share_done);
                }
            });
}
 
开发者ID:blueelwang,项目名称:oschina-app,代码行数:32,代码来源:BaseDetailFragment.java

示例4: onShareItemSelected

import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入方法依赖的package包/类
public void onShareItemSelected() {
    final UMSocialService socialService = UMServiceFactory.getUMSocialService("com.umeng.share");
    // Remove Tencent Weibo and QZone from share panel.
    socialService.getConfig().removePlatform(SHARE_MEDIA.TENCENT);
    socialService.getConfig().removePlatform(SHARE_MEDIA.QZONE);

    String webLink = this.topicInfo.getLinks().getWebURL();
    String shareContent = this.topicInfo.getTitle() + " " + webLink;
    String title = getString(R.string.share_topic, this.topicInfo.getUser().getData().getName());

    socialService.setShareContent(shareContent);

    if (!BuildConfig.QQ_APPID.isEmpty() && !BuildConfig.QQ_APPKEY.isEmpty()) {
        // Add QQ
        UMQQSsoHandler qqSsoHandler = new UMQQSsoHandler(this, BuildConfig.QQ_APPID, BuildConfig.QQ_APPKEY);
        qqSsoHandler.addToSocialSDK();

        QQShareContent qqShareContent = new QQShareContent();
        qqShareContent.setShareContent(shareContent);
        qqShareContent.setTitle(title);
        qqShareContent.setTargetUrl(this.topicInfo.getLinks().getWebURL());

        socialService.setShareMedia(qqShareContent);
    } else {
        socialService.getConfig().removePlatform(SHARE_MEDIA.QQ);
    }

    if (!BuildConfig.WX_APPID.isEmpty() && !BuildConfig.WX_SECRET.isEmpty()) {
        // Add WeiChat
        UMWXHandler wxHandler = new UMWXHandler(this, BuildConfig.WX_APPID, BuildConfig.WX_SECRET);
        wxHandler.addToSocialSDK();

        // Add WeChat Circle
        UMWXHandler wxCircleHandler = new UMWXHandler(this, BuildConfig.WX_APPID, BuildConfig.WX_SECRET);
        wxCircleHandler.setToCircle(true);
        wxCircleHandler.addToSocialSDK();

        //设置微信分享内容
        WeiXinShareContent weixinContent = new WeiXinShareContent();
        weixinContent.setShareContent(shareContent);
        weixinContent.setTitle(title);
        weixinContent.setTargetUrl(this.topicInfo.getLinks().getWebURL());
        weixinContent.setShareImage(new UMImage(this, topicInfo.getUser().getData().getAvatar()));
        socialService.setShareMedia(weixinContent);

        Logger.d(topicInfo.getUser().getData().getAvatar());
        //设置微信朋友圈分享内容
        CircleShareContent circleMedia = new CircleShareContent();
        circleMedia.setShareContent(shareContent);
        circleMedia.setTitle(title);
        circleMedia.setTargetUrl(this.topicInfo.getLinks().getWebURL());
        circleMedia.setShareImage(new UMImage(this, topicInfo.getUser().getData().getAvatar()));
        socialService.setShareMedia(circleMedia);
    }else{
        socialService.getConfig().removePlatform(SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE);
    }

    socialService.openShare(this, false);
}
 
开发者ID:CycloneAxe,项目名称:phphub-android,代码行数:60,代码来源:TopicDetailsActivity.java

示例5: onItemClick

import com.umeng.socialize.weixin.media.WeiXinShareContent; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    switch (position) {
        case 0:
            //qq好友分享
            QQShareContent qqContent = new QQShareContent();
            //分享文字
            qqContent.setShareContent(Constants.ShareLink+getArguments().getString(ITEMID));
            qqContent.setTitle("藤书坊");
            //分享的图片
            qqContent.setShareImage(new UMImage(getActivity(), getArguments().getString(IMGURL)));
            qqContent.setTargetUrl(Constants.ShareLink + getArguments().getString(ITEMID));
            controller.setShareMedia(qqContent);
            shareMessage(SHARE_MEDIA.QQ);
            break;
        case 1:
            //qq空间分享
            QZoneShareContent qZoneContent = new QZoneShareContent();
            qZoneContent.setShareContent("以书会友,以书交友");
            qZoneContent.setTargetUrl(Constants.ShareLink + getArguments().getString(ITEMID));
            qZoneContent.setTitle("藤书坊");
            qZoneContent.setShareImage(new UMImage(getActivity(), getArguments().getString(IMGURL)));
            controller.setShareMedia(qZoneContent);
            shareMessage(SHARE_MEDIA.QZONE);
            break;
        case 2:
            //新浪微博分享
            controller.setShareImage(new UMImage(getActivity(),getArguments().getString(IMGURL)));
            controller.setShareContent("以书会友,以书交友" +Constants.ShareLink + getArguments().getString(ITEMID));
            shareMessage(SHARE_MEDIA.SINA);
            break;
        case 3:
            //威信好友分享
            //设置微信好友分享内容
            WeiXinShareContent weixinContent = new WeiXinShareContent();
            //设置分享文字
            weixinContent.setShareContent("以书会友,以书交友");
            //设置title
            weixinContent.setTitle("藤书坊");
            //设置分享内容跳转URL
            weixinContent.setTargetUrl(Constants.ShareLink + getArguments().getString(ITEMID));
            //设置分享图片
            weixinContent.setShareImage(new UMImage(getActivity(),getArguments().getString(IMGURL)));
            controller.setShareMedia(weixinContent);
            shareMessage(SHARE_MEDIA.WEIXIN);
            break;
        case 4:
            //朋友圈分享
            //设置微信朋友圈分享内容
            CircleShareContent circleMedia = new CircleShareContent();
            circleMedia.setShareContent("以书会友,以书交友");
            //设置朋友圈title
            circleMedia.setTitle("藤书坊");
            circleMedia.setShareImage(new UMImage(getActivity(),getArguments().getString(IMGURL)));
            circleMedia.setTargetUrl(Constants.ShareLink + getArguments().getString(ITEMID));
            controller.setShareMedia(circleMedia);
            shareMessage(SHARE_MEDIA.WEIXIN_CIRCLE);
            break;
        default:
            break;
    }
}
 
开发者ID:rantianhua,项目名称:ShuTuier,代码行数:63,代码来源:ShareFragment.java


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