I am trying to read a file from an SD card, but find that I do not have read permissions. First, I get the public storage directory and list the following files:
File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); File[] files = dir.listFiles();
Then I select one of the files and check if it is available:
Log.d(TAG, files[0].canRead());
This always displays false, and I'm not sure why. I can write to a directory (actually this is the file I wrote that I want to read) and I tried the options
files[0].setReadable(true);
and
dir.setReadable(true);
bad luck. I also have
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
included in my manifest file and make sure my device is not connected to anything (as suggested here ), but it is not.
I can extract the file from the device and read it in a text editor. Any ideas as to what this might be?
Statistics: Using API 12 on a Samsung Galaxy tablet.
source share