w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
I'm Trying to Get a File object using an intent requesting an openable content

I'm Trying to Get a File object using an intent requesting an openable content.

That is not possible in any reliable fashion.

This is akin to saying "I'm trying to get a File object using an HTTP URL from a Web server". While the Web server has a file, you do not have direct file server access to that server. You can get a stream, and create your own file out of that stream.

Similarly, with a ContentProvider, a Uri is not a File. Whether you use openInputStream() on ContentResolver, or get the FileDescriptor and open a stream on that, you need to consume the content as a stream.

After all, there is no requirement that the content be stored in a regular file in the first place, let alone one that you can access. The content may be in an encrypted file, in a BLOB column in a database, etc.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.