SharedSdk 是第三方分享各大平台的框架,使用起来也比较简单、易用(不好的是,统计不到分享数据,不知道为什么),这里,我只实现啦:微信好友、微信朋友圈、微信收藏、QQ好友、QQ空间和短信的分享,其他平台请到官网查询(官网:http://www.mob.com/#/index)。
实现代码如下:
/**
* 微信分享
*/
private void weixin(int type){
ShareSDK.initSDK(this);
ShareParams wechat = new ShareParams();
wechat.setTitle("在这写标题");
wechat.setText("在这写内容");
// wechat.setImageUrl(shared_ImgUrl);//添加分享中显示的图片
//在这里添加分享的点击的链接地址
wechat.setUrl("http://www.baidu.com");
wechat.setShareType(Platform.SHARE_WEBPAGE);
Platform weixin = null;
if(type == 0){
weixin = ShareSDK.getPlatform(Wechat.NAME);
}else if(type == 1){
weixin = ShareSDK.getPlatform(WechatMoments.NAME);
}else{
weixin = ShareSDK.getPlatform(WechatFavorite.NAME);
}
// weixin.setPlatformActionListener(this);
weixin.share(wechat);
}
/**
* qq空间分享
* @param context
* @param shared_ImgUrl
*/
private void qzone(){
ShareSDK.initSDK(this);
ShareParams sp = new ShareParams();
sp.setTitle("在这写标题");
sp.setTitleUrl("http://www.baidu.com"); // 分享的链接地址
sp.setText("在这些内容");
// sp.setImageUrl(shared_ImgUrl);//添加分享中显示的图片
Platform qzone = ShareSDK.g