0
我一直在一個問題整個上午奮鬥,並認爲我現在要問這裏。9貼片png原始資源附加到電子郵件是不是原始文件
我用下面的代碼9個圖像附加到電子郵件:
sendIntent.setType("image/png");
ArrayList<Uri> uris = new ArrayList<Uri>();
uris.add(Uri.parse("android.resource://com.android9patch.viewer/raw/" + mBaseFilename + String.format("%05d", mAppBackgroundCurrentFile)));
sendIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(Intent.createChooser(sendIntent, "Email:"));
的問題是,當我收到的電子郵件,圖像是不是原來的9補丁,但版本沒有規模和填充標記。
我應該得到這樣的結果:
,但我得到這個代替:
我懷疑是應用處理原始文件發送之前?
信息:
我現在試圖將文件複製到SD卡保存附加到電子郵件之前。那麼,出於某種原因,即使複製也會刪除比例和填充標記...我不明白。
這是我從raw copy function拿的複印功能。
private boolean copyToSDCard(int resourceID, String finalName)
{
String extStorageDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString();
OutputStream out = null;
try
{
InputStream in = getResources().openRawResource(resourceID);
out = new FileOutputStream(extStorageDirectory + "/" + finalName + ".9.png");
copyFile(in, out);
in.close();
in = null;
out.flush();
out.close();
out = null;
}
catch (Exception e)
{
Log.e("copyToSDCard", e.toString());
e.printStackTrace();
}
return false;
}
private void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while((read = in.read(buffer)) != -1){
out.write(buffer, 0, read);
}
}