如何捕捉图像,并将其作为附件从一个应用程序? [英] How to capture an image and set it as attachment from an application?

查看:116
本文介绍了如何捕捉图像,并将其作为附件从一个应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的应用程序启动相机,想用拍摄的图像以附件形式在我的应用程序。 用例是如下:

I want to launch the camera from my application and want to use the captured image as an attachment in my application. The use case is as below:

preSS的应用程序 - >拍摄按钮打开相机应用程序 - >拍摄图像 - >图像显示为缩略图在​​我的应用程序

Press the capture button in the application->Opens camera application -> capture an image->the image is shown as thumbnail in my application.

任何建议,意见,将是非常有益的。

Any suggestions, ideas, would be very helpful.

推荐答案

图像捕获步骤说明:

<一个href="http://stackoverflow.com/questions/4184951/get-path-of-image-from-action-image-capture-intent/4185511#4185511">Get从ACTION_IM​​AGE_CAPTURE意图的图像路径​​。

在这之后,您可以获取图像的路径。然后,你可以用它为你的目的。它显示为小位图,并附原始的进一步处理。

After that, you have path of the fetched image. Then you can use it for your purpose. Show it as small Bitmap, and attach the original to further processing.

要查看拍摄的图像,发送意图

To view captured image, send the intent

Intent viewImageIntent = new Intent();   
viewImageIntent.setAction(android.content.Intent.ACTION_VIEW);   
File file = new File(imageFilePath);   
viewImageIntent.setDataAndType(Uri.fromFile(file), "image/*");   
viewImageIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(viewImageIntent);     

这篇关于如何捕捉图像,并将其作为附件从一个应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆