/** * 只分享图片 * * @param bitmap bitmap */ private void sharedImage(Bitmap bitmap) { RxPermissions rxPermissions = new RxPermissions((Activity) context); rxPermissions.request(Manifest.permission.WRITE_EXTERNAL_STORAGE).subscribe(granted -> { if (granted) { String imgPath = initImagePath(bitmap); if (imgPath == null) return; Platform.ShareParams sp = new Platform.ShareParams(); sp.setTitle(null); sp.setText(null); sp.setImagePath(imgPath); sp.setShareType(Platform.SHARE_IMAGE);//设置分享为图片类型 Platform platform = ShareSDK.getPlatform(plantName);// 要分享的平台//QQ.NAME platform.setPlatformActionListener(mPlatformActionListener); // 设置分享事件回调 // 执行图文分享 platform.share(sp); } else { //用户拒绝的权限 } }); }