我的问题是我使用 QBContent.uploadFileTask(file, true, null, new QBEntityCallback() 将文件上传到QuickBlox . 但我登陆 onError(List list) . 请检查图片 .
-
这是我进入OnError方法:
-
在Logcat中显示:
这是我的代码:
protected void startLoadAttachAudio(final file file){Handler h = new Handler(Looper.getMainLooper()); h.post(new Runnable(){public void run(){
QBContent.uploadFileTask(file, true, null, new QBEntityCallback<QBFile>() {
@Override
public void onSuccess(QBFile qbFile, Bundle bundle) {
System.out.println("Success");
}
@Override
public void onSuccess() {
System.out.println("Success2");
}
@Override
public void onError(List<String> list) {
System.out.println("Failed.");
}
});
}//end of run
}); //end of handler
}
2 回答
您可以使用库上传文件,我使用的是android async http . 例如:
requestParams用于发送params你的webservice,文件你知道你的文件 . 你可以编辑我的功能 .
在build.gradle中,你必须在依赖bloc然后同步中添加此代码编译'com.loopj.android:android-async-http:1.4.9' .
我通过更新Quickblox的SDK版本自己解决了这个问题