从的parseObject获取文件 [英] Get file from parseObject
问题描述
这是Android的少的问题,更Parse.com问题,但我需要你的帮助:
It's less android question and more Parse.com question, but I need your help:
我在我的应用程序表中的图像文件在Parse.com
I have an image file in a table in my application at Parse.com
该文件是好的,我可以手动下载并观看。
The file is ok, I can manually download it and watch it.
但是,试图开始使用的parseObject我alreay从服务器获取它的时候,我得到空
But when trying to get it using parseObject that I alreay get from server, I'm getting "null"
code:
byte[] imageFile = parseObject.getBytes(Statics.COL_IMAGE_FILE);
我在做什么错了?
What am I doing wrong?
P.S。 :我可以看到的parseObjectestimatedData字段中的图像文件的数据/链接,但不能让他
p.s. : I can see the image file data/link in the parseObject "estimatedData" field, but can't get him.
推荐答案
如果 Statics.COL_IMAGE_FILE
是的 文件
列,你应该做到以下几点得到的byte []:
If Statics.COL_IMAGE_FILE
is a File
column, you should do the following to get byte[]:
ParseFile imageFile = (ParseFile)parseObject.get(Statics.COL_IMAGE_FILE);
imageFile.getDataInBackground(new GetDataCallback() {
public void done(byte[] data, ParseException e) {
if (e == null) {
// data has the bytes for the image
} else {
// something went wrong
}
}
});
这篇关于从的parseObject获取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!