I am trying to read pdf files in the android app.
Fire following intent to get URI.
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("application/pdf");
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
startActivityForResult(intent, PDF_FILE_SELECTOR_INTENT_ID);
Problem is, the Downloads
folder also shows old files that I have deleted.
Also, when I select those files a valid URI
is returned in onActivityResult()
. When I create File
from URI
and check exists()
it returns false
which makes sense as I have already deleted the file from the Downloads
folder.
How can I make sure that the Downloads
folder shown on ACTION_GET_CONTENT
shows only files which are currently present and not deleted ones?
Thanks.