DBRoulette.java
private final String DATA_DIR = "/DataBase/";
Dropbox
下载随机图片
public DownloadRandomPicture(Context context, DropboxAPI<?> api,
String dropboxPath, ImageView view) {
mPath = dropboxPath;
doInBackground()
Entry dirent = mApi.metadata(mPath, 1000, null, true, null);
if (!dirent.isDir || dirent.contents == null) {
// It's not a directory, or there's nothing in it
mErrorMsg = "File or empty directory";
return false;
}
此代码在 DownloadRandomPicture.java
上不起作用
有人知道如何解决吗?
最佳答案
如果我们使用
final static private AccessType ACCESS_TYPE = AccessType.DROPBOX;
我们应该
Entry dirent = mApi.metadata(mPath, 1000, null, false, null);
但是如果我们使用
final static private AccessType ACCESS_TYPE = AccessType.APP_FOLDER;
我们应该使用
Entry dirent = mApi.metadata(mPath, 1000, null, true, null);
差异在于 dirent 的 boolean 值
关于java - 检查 dir 存在和 dir contains 在 dropbox api 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11931257/