在android kitkat 4.4的SD卡访问问题
问题描述:
我已经能够找到设备上的内部和外部SD卡的路径。 一切运行良好,但只在4.4之前的设备上运行。在android kitkat 4.4的SD卡访问问题
当我在4.4.x设备上测试代码时,我无法访问我必须从外部SD卡上传的文件。
如何解决这个
答
首先确定哪些文件,你从记忆 要那么像这样使用。
Intent pictureActionIntent = new Intent(Intent.ACTION_GET_CONTENT, null);
pictureActionIntent.setType("image/*");
pictureActionIntent.putExtra("return-data", true);
startActivityForResult(pictureActionIntent, 0);
+0
我不想使用intent – 2014-11-05 12:27:32
+0
然后你需要使用你可以访问数据的内容提供者 – 2014-11-08 08:09:35
的Android SDK中没有 “内部和外部的SD卡”。有[内部存储](http://commonsware.com/blog/2014/04/07/storage-situation-internal-storage.html),有[外部存储](http://commonsware.com/blog /2014/04/08/storage-situation-external-storage.html)和(在很小程度上)有[可移动存储](http://commonsware.com/blog/2014/04/09/storage -situation移动-storage.html)。在Android 4.4之前,Android SDK没有正式访问可移动存储,而Android 4.4+极大地限制了您可以访问的可移动存储的部分。 – CommonsWare 2014-11-05 12:08:03
发布您的代码不起作用 – Carsten 2014-11-05 12:15:59
@CommonsWare这意味着我的应用程序可以在4.4.x之前的设备上正常工作,而对于4.4.x以上的设备,我必须仅限于内部存储。 – 2014-11-05 12:20:19