Android如何分享本地视频到QQ空间? 5C

图片说明
上面的代码分享视频到微信和QQ都没问题,分享到qq空间报以下异常,手机已经安装了QQ空间,并且能成功分享图片。
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at android.view.View$DeclaredOnClickListener.onClick(View.java:4768)
at android.view.View.performClick(View.java:5685) 
at android.view.View$PerformClick.run(View.java:22481) 
at android.os.Handler.handleCallback(Handler.java:751) 
at android.os.Handler.dispatchMessage(Handler.java:95) 
at android.os.Looper.loop(Looper.java:241) 
at android.app.ActivityThread.main(ActivityThread.java:6274) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND dat=content://gamepp.com.gameppapplication.fileProvider/external_storage_root/Movies/Replay_2018.04.16-12.17.mp4 typ=video flg=0x10000001 pkg=com.qzone clip={video U:file:///storage/emulated/0/Movies/Replay_2018.04.16-12.17.mp4} (has extras) }

Q666666666666
Q666666666666 你好,请问可以给一下完整的代码吗?
4 个月之前 回复

1个回答

 http://wiki.open.qq.com/wiki/mobile/SDK下载  

<!-- QZone分享必须加上下面两个activity -->      
         <activity
            android:name="com.tencent.connect.common.AssistActivity"
            android:configChanges="orientation|keyboardHidden"
            android:screenOrientation="portrait"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" />
        <activity
            android:name="com.tencent.tauth.AuthActivity"
            android:launchMode="singleTask"
            android:noHistory="true" >
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="tencent222222" /> <!--Appid:222222-->
     <!-- 100380359 100381104 222222  -->
            </intent-filter>
        </activity>


oncreate中
 //QQ
  mTencent = Tencent.createInstance(Constant.QQKJ_APPID, this);


 /**
     * qq空间分享
     * @param v
     */
    public void toShareQQKJ(){
       final Bundle params = new Bundle();
          params.putInt(QzoneShare.SHARE_TO_QZONE_KEY_TYPE, QzoneShare.SHARE_TO_QZONE_TYPE_IMAGE_TEXT);//类型
          params.putString(QzoneShare.SHARE_TO_QQ_TITLE, "霸气的小明");//标题
          params.putString(QzoneShare.SHARE_TO_QQ_SUMMARY, "霸气的呵呵小明 ");//概要
          params.putString(QzoneShare.SHARE_TO_QQ_TARGET_URL, "http://www.beehood.com");
          //下面这个必须加上  不然无法调动 qq空间
          ArrayList<String> imageUrls = new ArrayList<String>();  
          imageUrls.add("http://www.beehood.com/uploads/allimg/150310/2-150310142133.jpg");  
          params.putStringArrayList(QzoneShare.SHARE_TO_QQ_IMAGE_URL, imageUrls);  
          doShareToQzone(params);

    }

    /**
     * 用异步方式启动分享
     * @param params
     */
    private void doShareToQzone(final Bundle params) {
        new Thread(new Runnable() {

            @Override
            public void run() {
                // TODO Auto-generated method stub
             mTencent.shareToQzone(SettingActivity.this, params, qZoneShareListener);
            }
        }).start();
    }


    /**
     * 分享监听
     */
    IUiListener qZoneShareListener = new IUiListener() {

        @Override
        public void onCancel() {
         //  Toast.makeText(SettingActivity.this, "取消", 0).show();
         Log.i("QZone", "取消分享");
        }

        @Override
        public void onError(UiError e) {
         Log.i("QZone", "出错:"+e.errorMessage);
            // TODO Auto-generated method stub
        // Toast.makeText(SettingActivity.this,  "onError: " + e.errorMessage, 0).show();
        //    Util.toastMessage(QZoneShareActivity.this, "onError: " + e.errorMessage, "e");
        }

@Override
public void onComplete(Object response) {
Log.i("QZone", "完成分享");
// TODO Auto-generated method stub
// Toast.makeText(SettingActivity.this, "onComplete: " + response.toString(), 0).show();
//  Util.toastMessage(QZoneShareActivity.this, "onComplete: " + response.toString());
}
  };
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!