Dropbox API Android
这个问题主要与安卓系统有关,不过有点笼统 我可以使用Dropbox API Android,android,dropbox,dropbox-api,dropbox-entry,Android,Dropbox,Dropbox Api,Dropbox Entry,这个问题主要与安卓系统有关,不过有点笼统 我可以使用getFile和类似的API调用上传和下载文件,但是,我正在尝试访问Dropbox上已经存在的目录并列出它的内容 使用API,我希望能够引用路径“/path/to/dir/”处的目录,并使用Entry.contents列出其中的所有Entry对象 我试过这个,但不起作用: Entry dir = new Entry(); dir.path = "/path/to/dir"; Log.d(TAG, "isDir ? " + Boolean.toS
getFile
和类似的API调用上传和下载文件,但是,我正在尝试访问Dropbox上已经存在的目录并列出它的内容
使用API,我希望能够引用路径“/path/to/dir/”处的目录,并使用Entry.contents
列出其中的所有Entry
对象
我试过这个,但不起作用:
Entry dir = new Entry();
dir.path = "/path/to/dir";
Log.d(TAG, "isDir ? " + Boolean.toString(dir.isDir));
for (Entry entry : dir.contents) {
Log.d(TAG, entry.filename());
}
目录不是空的isDir
返回false
且不打印任何文件名
有没有办法做到这一点,或者我需要使用搜索方法
我只需要现有目录中的文件列表
非常感谢这可以通过元数据功能完成:
String path2Dir = "path/to/dir";
Entry dir = mDropboxApiInstance.metadata(path2Dir, null, true, null);
List<Entry> contents = dir.contents;
for (Entry dropboxFile : contents){
// do stuff with remote file's data
}
String path2Dir=“path/to/dir”;
Entry dir=mDropboxApiInstance.metadata(path2Dir,null,true,null);
列表内容=目录内容;
对于(条目dropboxFile:contents){
//处理远程文件的数据
}