We Want to Hear From You! What Do You Want to See on the Community? Tell us here!
Forum Discussion
willbu1971
8 years agoNew member | Level 2
Copying files FROM Dropbox to my Android app
Hi all. I'm new to the DropBox SDK so please forgive if I ask a question that has been asked many times. I did do a search on the site but could not find anything like what I'm attempting to do.
I want to store a directory of photos (PNGs) on a DropBox folder. I'm writing an Android app using Android Studio (Gradle) that contains an activity that will be a photo gallery. When the activity loads, I want the app to connect to the DropBox folder and copy the files to the app's 'drawable' folder. The app will then build the photo gallery on the fly based on those photos. The SDK for Java seems to be somewhat out of date as the sample code for connecting to DropBox contains a method that is deprecated.
I've written the code to ennumerate through the drawable folder and build the photo gallery. All I need is an example of where you use Java to connect to a folder in DropBox and copies (transfers) the files in that folder to the app. Or even more simply, if I could see an example where you use Java to connect to the DropBox folder and make a list of the files in that folder - that would work. I can probably figure out how to copy the files to the app myself.
Thanks in advance for your time and assistance!
- Where exactly is the deprecated method usage that you're referring to? I'll ask the team to update that.
Anyway, there's a sample of listing items in a folder here:
https://github.com/dropbox/dropbox-sdk-java/blob/7ecc15cf0f51d6ae2ba5cdb334aac2c2f3474b87/examples/android/src/main/java/com/dropbox/core/examples/android/ListFolderTask.java#L43
And there's a sample of downloading files here:
https://github.com/dropbox/dropbox-sdk-java/blob/7ecc15cf0f51d6ae2ba5cdb334aac2c2f3474b87/examples/android/src/main/java/com/dropbox/core/examples/android/DownloadFileTask.java#L67
3 Replies
Replies have been turned off for this discussion
- Greg-DB8 years ago
Dropbox Community Moderator
Where exactly is the deprecated method usage that you're referring to? I'll ask the team to update that.
Anyway, there's a sample of listing items in a folder here:
https://github.com/dropbox/dropbox-sdk-java/blob/7ecc15cf0f51d6ae2ba5cdb334aac2c2f3474b87/examples/android/src/main/java/com/dropbox/core/examples/android/ListFolderTask.java#L43
And there's a sample of downloading files here:
https://github.com/dropbox/dropbox-sdk-java/blob/7ecc15cf0f51d6ae2ba5cdb334aac2c2f3474b87/examples/android/src/main/java/com/dropbox/core/examples/android/DownloadFileTask.java#L67 - willbu19718 years agoNew member | Level 2
The page at https://www.dropbox.com/developers/documentation/java links to Github. On that page (https://github.com/dropbox/dropbox-sdk-java) in the 'Link an account' section you see the code example given for the version 2 API. Specifically, the main method contains this line:
DbxRequestConfig config = new DbxRequestConfig("dropbox/java-tutorial", "en_US");
In Android Studio, DbxRequestConfig is flagged as deprecated.
Someone also posted about this issue on Stack Overflow (https://stackoverflow.com/questions/47302711/dbxrequestconfig-is-deprecated-in-api-v2)
Thanks for linking the examples!
- Greg-DB8 years ago
Dropbox Community Moderator
Thanks! I'll ask the team to update that accordingly.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 12 hours ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!