简体   繁体   中英

Sync dropbox file for android

I was wondering why my file is not updating to dropbox. Currently it only creates the an empty file.

final String TEST_FILE_NAME = DateTime + ".txt";
        DbxPath path = new DbxPath(DbxPath.ROOT, TEST_FILE_NAME);
        try {
            if (!FileSystem.exists(path)) {
                newFile = FileSystem.create(path);
                try {
                    newFile.writeString("Hello world!");

                } finally {
                    newFile.update();
                    newFile.close();
                }
            }
        } catch (DbxException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }

Solved: I never unlinked my dbxacc and kept relinking, causing errors to show up! Silly mistake.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM