2014-11-05 59 views
0

我已經能夠找到設備上的內部和外部SD卡的路徑。 一切運行良好,但只在4.4之前的設備上運行。在android kitkat 4.4的SD卡訪問問題

當我在4.4.x設備上測試代碼時,我無法訪問我必須從外部SD卡上傳的文件。

如何解決這個

+0

的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

+0

發佈您的代碼不起作用 – Carsten 2014-11-05 12:15:59

+0

@CommonsWare這意味着我的應用程序可以在4.4.x之前的設備上正常工作,而對於4.4.x以上的設備,我必須僅限於內部存儲。 – 2014-11-05 12:20:19

回答

0

首先確定哪些文件,你從記憶 要那麼像這樣使用。


 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