我的情況如下:我正在將多個位圖從陣列列表保存到我的設備中的特定文件夾SD卡(成功),但保存的文件 - 當點擊 - 從手機提示消息,指出:「無法找到應用程序來執行此操作。」此文件的文件大小與正在保存的位圖圖像的文件大小成正比,所以我有點困惑,因爲設備沒有打開圖像文件的問題,但無法打開(或識別)這些文件作爲媒體文件。將位圖從ArrayList保存到SD卡 - 保存的文件無法讀取
問題:什麼會導致保存的圖像文件(假設我已經保存正確)在設備中顯示這種類型的行爲,我該如何解決此問題?
額外:文件的縮略圖是系統提供的兩張紙的縮略圖。 ArrayList從一個活動傳遞到當前提供的方法。
這裏是調用的文件保存到指定文件夾/ filesdestination方法:
private void saveImages(){
// to retrieve bitmaps
ArrayList<Bitmap> images = getIntent().getParcelableArrayListExtra("images key");
//to retrieve bitmaps and save in specific order, while also naming them in that order
int loopVal = 0;
int postVal = 9;
while (loopVal < 9) {
Bitmap Image = images.get(loopVal);
try {
String filedestination = new String(Environment.getExternalStorageDirectory() + "/filedestination");
String timeStamp = new SimpleDateFormat("ddMMyyyy_HHmm").format(new Date());
File file = new File(filedestination, postVal + ".post_order" + ".jpg" + timeStamp);
File picfile = file;
FileOutputStream fos = new FileOutputStream(picfile);
Image.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.close();
} catch (Throwable e) {
e.printStackTrace();
}
postVal--;
loopVal++;
}
}
任何有識之士將不勝感激我認爲它無法讀取,
-Lucas
這工作!我現在知道.jpg的.png位置在跨應用程序可讀性方面有多重要,謝謝! – Lucas 2014-10-30 00:45:10
您的歡迎,很高興能夠得到幫助:) – JRowan 2014-10-30 00:57:27