2011-10-20 131 views
1

正在運行的應用程序必須訪問內部存儲文件夾中平板電腦上存儲的文件 。任何人都可以告訴我 如何訪問它?在Android中查找存儲路徑

+0

我不知道,但像,Media.INTERNAL_CONTENT_URI。嘗試一下。 – user370305

回答

8

這是怎麼回事?

return Environment.getExternalStorageDirectory().toString() + "/Music"; 
1

見的Android data storage文件的internal storage section ..

編輯

我認爲你應該使用ContextWrapper ..Personally我從來沒有嘗試過這個..

ContextWrapper cw = new ContextWrapper(context); 
File directory = cw.getDir("your music folder name here", Context.MODE_PRIVATE); 

請檢查目錄爲空或不在使用之前..

編輯

請參閱this螺紋..這可能會幫助你

+0

其實我想要在平板設備上獲取音樂文件夾的路徑。不適用於我的應用程序內部文件夾 – Prasanth

-1

您可以使用:

File f = new File(Environment.getExternalStorageState()); 
+0

爲什麼不簡單使用'File f = Environment.getExternalStorageDirectory()'?創建的對象越少越好。 – Pijusn