如何将我拥有他的 Uri 的文件(图像)上传到自定义对象中?
我试过这个:
public void onClick(View v) {
HashMap<String, Object> fields = new HashMap<String, Object>();
File newImage = new File(imageUri.toString());
fields.put("image", newImage);
fields.put("bla", "bla");
QBCustomObject qbCustomObject = new QBCustomObject();
qbCustomObject.setClassName("imageClass"); // your Class name
qbCustomObject.setFields(fields);
QBCustomObjects.createObject(qbCustomObject, new QBCallbackImpl() {
@Override
public void onComplete(Result result) {
if (result.isSuccess()) {
QBCustomObjectResult qbCustomObjectResult = (QBCustomObjectResult) result;
QBCustomObject qbCustomObject = qbCustomObjectResult.getCustomObject();
// Log.d("New record: ",newCustomObject.toString());
} else {
Log.e("Errors",result.getErrors().toString());
}
}
});
我只得到字符串(“bla”)和图像得到 - null
谢谢