我正在编写一个程序,用户可以在其中选择SD卡中的一个文本文件。 我使用此代码授予用户访问sdcard的权限:
在oncreate方法中:
Intent intent = new Intent();
intent.setType("*/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "getFile"),
22);
但是,我无法访问SD卡。任何人都可以帮帮我吗? p.s我不想使用任何外部库,如fileChooser等。
答案 0 :(得分:0)
您需要在AndroidManifest.xml文件中添加READ_EXTERNAL_STORAGE权限:
http://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE