我的代码应该能够存储可绘制的画布以及背景视图。
public void saveImage(Bitmap bitmap)
{
String filename = String.valueOf(System.currentTimeMillis());
ContentValues values = new ContentValues();
values.put(Images.Media.TITLE, filename);
values.put(Images.Media.DATE_ADDED, System.currentTimeMillis());
values.put(Images.Media.MIME_TYPE, "image/**");
Uri uri = this.getContentResolver().insert(Images.Media.EXTERNAL_CONTENT_URI,values);
try
{
OutputStream outStream = this.getContentResolver()
.openOutputStream(uri);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outStream);
outStream.flush();
System.out.println("SAVEEEEEEEEEEEEEEEEEEEEE IS CALLING");
outStream.close();
Toast.makeText(ImagePaint.this, "Image Saved!", Toast.LENGTH_SHORT).show();
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}