I want to check whether a file exists. Since the check could be on external SD card, I can't use File.Exists(). Instead I need to use DocumentFile.exists().
https://developer.android.com/reference/android/support/v4/provider/DocumentFile.html#exists()
When I tried DocumentFile.exists(), I always got True regardless of file's existence. Based on a DocumentFile example Erel posted, I then tried to implement the same using fromFile() and it worked. But it is too slow as it scans the entire list of files. I feel exists() could be faster. Please help.
https://developer.android.com/reference/android/support/v4/provider/DocumentFile.html#exists()
When I tried DocumentFile.exists(), I always got True regardless of file's existence. Based on a DocumentFile example Erel posted, I then tried to implement the same using fromFile() and it worked. But it is too slow as it scans the entire list of files. I feel exists() could be faster. Please help.