PickiT
An Android library that returns real paths from Uri's.
Demo screenshot:
Download the demo app here
Add Pickit to your project:
Add the following in your root build.gradle at the end of repositories:
Then, add the dependency, in your app level build.gradle:
Implementation:
First, implement PickiT callbacks in the Activity
that you want to use it, as shown below:
Alt+Enter
to implement the methods, we will discuss the methods later in the readme.
Implement pickiT in your onCreate()
method, as shown below:
You can now select a file as you usually would (have a look at the demo if you don't know how to do this).
Then in onActivityResult
, you can pass the path to PickiT, as shown below:
Dropbox, Google Drive, OneDrive and files from unknown file providers:
If the selected file was from Dropbox,Google Drive, OneDrive or an unknown file provider, it will then be copied/created in
Internal Storage - Android - data - your.package.name - files - Temp
It is your responsibility to delete the file when you are done with it, by calling:
This can be done in onBackPressed
and onDestroy
, as shown below:
If you do not call pickiT.deleteTemporaryFile();
, the file will remain in the above mentioned folder and will be overwritten each time you select a new file from Dropbox,Google Drive, OneDrive or an unknown file provider.
Callback methods
Have a look at the demo project if you have any issues implementing the library.