androidparcelfiledescriptor

Android ParcelFileDescriptor to path string


If I have a ParcelFileDescriptor that is being passed to me and I need to call an API that requires a filePathString, I don't see how to map this? Short of creating a temp file and then passing that as a path is there a cleaner way of doing this?


Solution

  • Nope, you're on the right track. Create a temp file and copy the data into it. That's as clean as it gets.

    Bear in mind that, despite the name, a ParcelFileDescriptor may have nothing to do with an actual file on the filesystem, let alone one that you have direct filesystem access to.