Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8139271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:46:16+00:00 2026-06-06T11:46:16+00:00

I am working on Dropbox. I see the documentation. This is my code to

  • 0

I am working on Dropbox. I see the documentation. This is my code to display list:

Entry entryCheck = mApi.metadata("/", 100, null, true, null);
Log.i("Item Name", entryCheck.fileName());
Log.i("Is Folder", String.valueOf(entryCheck.isDir));

I got all list from dropbox but my question is that

  1. Here entryCheck.isDir always give me true value if it is file or directory so how i can know which is file or which one is directory?
  2. How i downloaded that files.

I tried with this but it is not working:

private boolean downloadDropboxFile(String dbPath, File localFile,
        DropboxAPI<?> api) throws IOException {
    BufferedInputStream br = null;
    BufferedOutputStream bw = null;
    try {
        if (!localFile.exists()) {
            localFile.createNewFile(); // otherwise dropbox client will fail
            // silently
        }                   

        DropboxInputStream fin = mApi.getFileStream("dropbox", dbPath);
        br = new BufferedInputStream(fin);
        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) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } finally {
        // in finally block:
        if (bw != null) {
            bw.close();
        }
        if (br != null) {
            br.close();
        }
    }

    return true;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:46:19+00:00Added an answer on June 6, 2026 at 11:46 am

    This will work

    String inPath ="mnt/sdcard/"+filename;
    File file=new File(inPath);           
    try {
    
        mFos = new FileOutputStream(file);
    } catch (FileNotFoundException e) {
        mErrorMsg = "Couldn't create a local file to store the image";
        return false;
    }
    
    mApi.getFile("/"+filename, null, mFos, null);
    

    This downloads the file and store it in the sdcard location inPath.
    You have to do it in a new thread,not in main thread.Use AsyncTask.
    http://www.androiddesignpatterns.com/2012/06/app-force-close-honeycomb-ics.html
    this link explains why..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have website A: http://dl.dropbox.com/u/3264697/calc/v2/index.html It is working as intended, 100%. I have website
I'm using the Dropbox command-line utility/daemon on Ubuntu 11.10 but it's not working with
I really don't get why this is not working. I want to avoid a
I have two dev machines. My code is synced between the two with dropbox
I'm working on a wrapper for dropbox in delphi 2012. The problem I'm running
I am working on a dropbox like system and I am wondering how the
I'm working with people using only Dropbox as version control and collaboration tool. I
I am working on syncing my MySql database on two computers (using dropbox with
I'm working on moving my whole vim config to my Dropbox folder in order
I am working on a piece of code that I am wanting to spice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.