shareSdk分享圖片


   /**
     * 只分享圖片
     *
     * @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 {
                //用戶拒絕的權限
            }

        });


    }

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM