從資源複製圖像輸出到圖像文件中,你可以使用下面的方法SD卡上的圖片目錄:
Bitmap resourceImage = BitmapFactory.decodeResource(this.getResources(), R.drawable.resource_image1);
File externalStorageFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "resource_image1.jpg");
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
resourceImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
byte b[] = bytes.toByteArray();
try
{
externalStorageFile.createNewFile();
OutputStream filoutputStream = new FileOutputStream(externalStorageFile);
filoutputStream.write(b);
filoutputStream.flush();
filoutputStream.close();
}
catch (IOException e)
{
}
然後你就可以將它指定ACTION_SEND意圖圖像附件。
你有沒有試過建議的方法? – Zelimir 2010-12-14 10:39:10