我正在研究一個應用程序,該應用程序將繪製的畫布存儲爲SD卡中的jpeg圖像。 的問題是,當我試圖查看保存的圖像,它加載了很多的時間比我要在正常時間像其他圖像查看保存的圖像外的圖像 我保存的圖像代碼:保存jpeg以後查看
View content = drawView;
content.setDrawingCacheEnabled(true);
content.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
Bitmap bitmap = content.getDrawingCache();
String path = Environment.getExternalStorageDirectory().getAbsolutePath();
String file_name="Imatge"+System.currentTimeMillis()+".jpg";
File file = new File(path,file_name);
FileOutputStream ostream;
try {
ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.PNG,50, ostream);
ostream.flush();
ostream.close();
Toast.makeText(getApplicationContext(), " :) Image saved in "+ path+"/"+file_name, 5000).show();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(), e.toString()+"error", 5000).show();
}
}
在此先感謝請幫助我!
你是什麼意思它加載了很多的時間比其他圖像? –
在Android移動設備上拍攝的照片設備在正常時間播放,但由應用創建的圖像需要花很長時間才能查看圖庫中的圖像不知道爲什麼 –
確認了您的圖像文件大小?也許它太大了加載 –