public void myclick2(View v){
//QZone分享, SHARE_TO_QQ_TYPE_DEFAULT 图文,SHARE_TO_QQ_TYPE_IMAGE 纯图 ,SHARE_TO_QZONE_TYPE_IMAGE_TEXT 音乐
int shareType = QzoneShare.SHARE_TO_QZONE_TYPE_NO_TYPE;
final Bundle params = new Bundle();
params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, shareType);
params.putString(QzoneShare.SHARE_TO_QQ_TITLE, "分享的标题");
params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, "分享的内容");
params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, "http://www.baidu.com");//分享的链接
// 支持传多个imageUrl
ArrayList<String> imageUrls = new ArrayList<String>();
imageUrls.add("http://img3.douban.com/lpic/s3635685.jpg");
imageUrls.add("http://img3.douban.com/lpic/s3635685.jpg");
params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imageUrls);
doShareToQzone(params);
}
/**
* 用异步方式启动分享
* @param params
*/
private void doShareToQzone(final Bundle params) {
final Activity activity = MyQQloginShareActivity.this;
final Tencent tencent = Tencent.createInstance(mAppid, MyQQloginShareActivity.this);
new Thread(new Runnable() {
@Override
public void run() {
tencent.shareToQzone(activity, params, new IUiListener() {
@Override
public void onCancel() {
Toast.makeText(getApplicationContext(), "分享取消", 0).show();
}
@Override
public void onError(UiError e) {
Toast.makeText(getApplicationContext(), "分享错误", 0).show();
}
@Override
public void onComplete(Object response) {
Toast.makeText(getApplicationContext(), "分享完成", 0).show();
}
});
}
}).start();
}
源码:链接: http://pan.baidu.com/s/1qWwJQ24