我在从 Cloudboost 文件对象中获取所有文件信息时遇到了一点问题。这是我用来获取文件的 id、名称和 url 的代码。问题是我可以取回 id 和 name;但是,该 url 为空,我不知道为什么或如何修复它。有任何想法吗??
class FileQuery extends AsyncTask<Void, Void, Void> {
@Override
protected Void doInBackground(Void... params) {
CloudQuery query = new CloudQuery("Pubs");
query.include("file");
query.equalTo("id", "U1YV132B");
try {
query.find(new CloudObjectArrayCallback() {
@Override
public void done(CloudObject[] x, CloudException t) throws CloudException {
if (x != null) {
for (int i = 0; i < x.length; i++) {
final CloudFile f = new CloudFile(x[i].getDocument());
f.fetch(new CloudFileArrayCallback() {
@Override
public void done(CloudFile[] x, CloudException t) throws CloudException {
Log.d("dozer74", "File Id: " + f.getId()); // This will print out
Log.d("dozer74", "File Name: " + f.getFileName()); // This will print out
Log.d("dozer74", "File URL: " + f.getFileUrl()); // This is null
}
});
}
}
}
});
} catch (CloudException e) {
e.printStackTrace();
}
return null;
}
}
这是我如何称呼这门课
new FileQuery().execute();