We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
Andhie W.
10 years agoNew member | Level 1
Android ACTION_GET_CONTENT from Dropbox sources
Device OS: Lollipop 5.0
When using the Intent ACTION_GET_CONTENT and selecting Dropbox from the Storage Provider, Dropbox prompts a file picker dialog to choose from. The result obtained in onAc...
Craig M.21
10 years agoNew member | Level 2
Thanks for that. I have not had any problems with reading the file. I am therefore unsure what the problem was that the other posters met.
I have read and write permissions set.
I initially used code like this (based on suggestions found online):
ParcelFileDescriptor mInputPFD = null ;
try {
mInputPFD = getContentResolver().openFileDescriptor(returnUri, "r");
} catch (FileNotFoundException e) {
e.printStackTrace();
System.out.println("File not found...");
return;
}
if(mInputPFD!=null){
fd = mInputPFD.getFileDescriptor();
FileInputStream fis = new FileInputStream(fd);
//process the input stream
}
I tried the more direct method suggested above and it also worked:
FileInputStream fis = null ;
try {
fis = (FileInputStream) getContentResolver().openInputStream(returnUri);
}
catch (FileNotFoundException e1) {
e1.printStackTrace();
System.out.println("File not found...");
return ;
}
//process the input stream
I am using targeted Android API 19.
Can I assume that the ContentResolver#openInputStream(fileUri)
method will also work on API 18 and lower?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 2 years agoIf 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!