当我执行以下代码时,我收到了一个 Dropbox 取消链接异常。我将元数据中的文件放入一个字符串中,然后循环播放直到文件结束。但是我有这个问题。任何帮助深表感谢。
AndroidAuthSession session = buildSession();
mApi = new DropboxAPI<AndroidAuthSession>(session);
mApi.getSession().startAuthentication(TRDocsList.this);
checkAppKeySetup();
try {
dirent = mApi.metadata("/documents/", 1000, null, true, null);
fnames = null;
files = new ArrayList<Entry>();
dir = getListofDocs();
fnames = new String[dir.size()];
fnames = dir.toArray(fnames);
} catch (DropboxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
protected void onResume()
{
super.onResume();
if (mApi.getSession().authenticationSuccessful()) {
try {
// Required to complete auth, sets the access token on the session
mApi.getSession().finishAuthentication();
AccessTokenPair tokens = mApi.getSession().getAccessTokenPair();
} catch (IllegalStateException e) {
Log.i("DbAuthLog", "Error authenticating", e);
}
}
}
public ArrayList<String> getListofDocs() {
for(Entry ent: dirent.contents) {
files.add(ent);
dir.add(new String(files.get(i++).path));
}
i = 0;
fnames = dir.toArray(new String[dir.size()]);
return dir;
}