You need add a READ_EXTERNAL_STORAGE permission in your AndroidManifest.xml file:
http://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE
Question
I am writting a program in which user can select one of the text files in the sdcard. I am using this code to give the user access to sdcard:
in oncreate method:
Intent intent = new Intent();
intent.setType("*/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "getFile"),
22);
But, I can not access the sdcard. can anybody please help me? p.s i don't want to use any external library like fileChooser or etc.
Solution
You need add a READ_EXTERNAL_STORAGE permission in your AndroidManifest.xml file:
http://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE