0
在我的Paint應用程序中,我需要保存繪製的圖像。我的代碼正在工作,但圖像沒有保存到SD卡。下面我使用過的代碼。爲什麼我無法將表面視圖上的畫布繪製保存到Android中的SD卡
drawingSurfaceView.buildDrawingCache();
Bitmap bmap = drawingSurfaceView.getDrawingCache();
String extStorageDirectory = Environment.getExternalStorageDirectory()
.toString();
File file = new File(extStorageDirectory, "imag.PNG");
FileOutputStream outStream;
try {
outStream = new FileOutputStream(file);
bmap.compress(Bitmap.CompressFormat.PNG, 100, outStream);
MediaStore.Images.Media.insertImage(getContentResolver(),
file.getAbsolutePath(), file.getName(), file.getName());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
請告訴我,通過使用吸氣劑ANS位圖的制定者像drwaSurfaceView.setBitmap() 和drwaSurfaceView.getBitmap()什麼是錯的代碼