I developed an android-app for a customer. He can:
- pick multiple files (images, videos, files). These files are added to a ListView (containing only filenames).
- start an upload of these files to a server later on.
Yet, i save the file-paths internally and whenever the upload-button is clicked, i pick the files from the saved paths and transmit them to the server.
The problem is that all my methods for getting the path, use depcreated methods and deprecated media-columns like f.i.
MediaStore.Video.Media.DATA
So i got to get rid of these and, as API10 recommends, don't work with absolute paths anymore.
I' m getting the filename like this:
Cursor cursor = getApplicationContext().getContentResolver().query(uri, null, null, null, null);
int indexedname = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
cursor.moveToFirst();
String filename = cursor.getString(indexedname);
cursor.close();
QUESTION: So far so good. I got the file for the upload list. But how do i get the file only by name and without absolute path for the upload later on, whenever the user clicks on the upload-button?
I'm able to get a DocumentFile and the MIME from the ContentResolver and much more, but no File!
Thank you for your help in advance!