【发布时间】:2018-01-31 22:21:45
【问题描述】:
照片参数是位图,我检查了它,它显示了捕获的图像
如何将位图转换为路径,以便能够作为附件发送到邮件
这是代码:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.opencvhc);
ImgPhoto = (ImageView) findViewById(R.id.ImgPhoto);
Bundle extras = getIntent().getExtras();
if (extras != null) {
bm = (BitmapDataObject) getIntent().getSerializableExtra("photo"); //Obtaining data
bitmap = bm.getBip();
ImgPhoto.setImageBitmap(bitmap);
}
Checkmood = (Button) findViewById(R.id.Checkmood);
Check = (Button) findViewById(R.id.Check);
txtView = (TextView) findViewById(R.id.txt);
}
public void CheckClick(View view) throws IOException {
String file = MediaStore.Images.Media.insertImage(getContentResolver(), bitmap, "file", null);
//Uri screenshotUri = Uri.parse(file);
Toast.makeText(OpenCVhc.this, file, Toast.LENGTH_SHORT).show();
final Intent emailIntent1 = new Intent(android.content.Intent.ACTION_SEND);
emailIntent1.putExtra(Intent.EXTRA_EMAIL, new String[]{"comfplatform@gmail.com"});
emailIntent1.putExtra(Intent.EXTRA_SUBJECT, "Image processing picture");
emailIntent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// emailIntent1.putExtra(Intent.EXTRA_STREAM, screenshotUri);
emailIntent1.putExtra(Intent.EXTRA_TEXT, "" +
"We checked your photo with the Ecg-Leads \n 1) : " +
"\n the image proccessing ___ ");
emailIntent1.setType("image/png");
try {
startActivity(Intent.createChooser(emailIntent1, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(OpenCVhc.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
}
}
}
【问题讨论】:
-
你能发布你的图像捕获代码吗?