Datei kann nicht von Dropbox @ heruntergeladen werd

Ich lade eine Datei von Dropbox hoch und herunter. Wenn ich eine Datei hochlade, wird sie korrekt hochgeladen. Wenn ich eine Datei herunterlade und öffne, ist die Datei null Byte groß. Kann mir jemand sagen, warum das passiert?

Download-Code:

try {
    File localFile = new File(localFilePath);
    File fileSelected = new File(dropboxPath);

    if (!localFile.exists()) {
        localFile.createNewFile();
    } else {
        //copy(fileSelected, localFile);
        //mApi.copy("/Test/test.png", "/sdcard/testfile.png");

        BufferedInputStream br = null;
        BufferedOutputStream bw = null;
        DropboxInputStream fd;
        try {
            fd = mApi.getFileStream(fileSelected.getPath(), null);
            br = new BufferedInputStream(fd);
            bw = new BufferedOutputStream(new FileOutputStream(localFile));

            byte[] buffer = new byte[4096];
            int read;
            while (true) {
                read = br.read(buffer);
                if (read <= 0) {
                    break;
                }
                bw.write(buffer, 0, read);
            }    
        } catch (DropboxException e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (bw != null) {
                try {
                    bw.close();
                    if (br != null) {
                        br.close();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }/*
    else {
        showToast("File already exists");
    }*/
} 
catch (IOException e) {
    showToast("Exception");
    e.printStackTrace();
}
catch (Exception e) {
    showToast("Exception");
    e.printStackTrace();
}

Antworten auf die Frage(2)

Ihre Antwort auf die Frage