我想顯示圖片庫。問題在於加載它們。[Android] HTC Desire加載畫廊問題:路徑錯誤?
在開始的時候,我被加載圖片提供:
images = new File("/sdcard/DCIM/Camera/");
if(images.listFiles().length==0)
//no images, do some other stuff...
else
//put images in the gallery and do some stuff
該代碼可以使用仿真器(Android 2.2的 - API等級8),並與三星Galaxy S2(安卓2.2.1)。但我要求一些朋友用他們自己的手機測試這些代碼(HTC,LG ...)。
使用HTC Desire時,在加載過程中出現問題。該代碼是進入「//沒有圖像」,但他們有圖像的相冊(例如,從相機......)我的朋友對我說:
專輯存儲在內部存儲,而不是在與HTC的SD卡。
所以我會嘗試檢查其他目錄,如:
//Get the internal content
images = new File(MediaStore.Images.Media.INTERNAL_CONTENT_URI.getPath());
if (!images.isDirectory()) {
//Get the external content
images = new File(MediaStore.Images.Media.EXTERNAL_CONTENT_URI.getPath());
}
if (!images.isDirectory()) {
//Get the SD Card content
images = new File("/sdcard/DCIM/Camera/");
}
但仍然沒有工作:(這是不好的目錄:/
所以,我的問題是:我怎樣才能與所有Android手機圖像的好路子?是他們這是能夠返回專輯的路徑對象?
謝謝:)
(對不起,錯誤)
在我從標準的攝像頭應用程序HTC Ddesire照片保存在:'/ SD卡/ DCIM/100MEDIA /'從'/ SD卡/ DCIM /相機/'的Camera360應用中的照片。 – jamapag