Dropbox metadata()提供了一个未链接的异常

时间:2013-11-09 13:16:41

标签: android dropbox

执行以下代码时,我收到了一个dropbox unlink异常。我将文件从元数据中放入一个字符串并循环直到文件结束。但是我有这个问题。非常感谢任何帮助。

    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;
}    

1 个答案:

答案 0 :(得分:0)

我在appkey授权之后放了onResume()方法。这解决了我的问题。