1

次のコードを実行すると、ドロップボックスのリンク解除例外が発生します。ファイルをメタデータから文字列に入れ、ファイルの終わりまでループします。しかし、この問題が発生しています。どんな助けでも大歓迎です。

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

1 に答える 1

0

appkey 認証の後に onResume() メソッドを配置しました。これで私の問題は解決しました。

于 2013-11-26T10:48:53.233 に答える