My app needs to read a file selected by the user. I locate the file with the following:
Intent getHandsIntent = new Intent(Intent.ACTION_GET_CONTENT);
getHandsIntent.setType("file/*");
startActivityForResult(getHandsIntent, GLOBALS.rqFindFile);
// then, in onActivityResult...
if (RequestCode == GLOBALS.rqFindFile) {
if (ResultCode == RESULT_OK) {
String path = data.getData().getPath();
readHandsFile(path);
}
This works fine for local files. However, if the user chooses DropBox to locate the file, I get a message that the file is being downloaded before control returns to my onActivityResult code.
The path I get from the data is something of the form /filecache/635e8383-3a6e-424d-8437-d4d83421fcb8 but when I attempt to open this file for reading I am geting an Exception: /filecache/635e8383-3a6e-424d-8437-d4d83421fcb8: open failed: ENOENT (No such file or directory)
Any ideas?