[英]Android - Capture photo
In my application, i have to implement native camera activity where i have to launch the camera and take photo. 在我的应用程序中,我必须实现原生相机活动,我必须启动相机并拍照。
In detail, my application containing, One TextView (at top) to display activity name and one Button (At bottom) and in Middle Area of the screen, Camera preview should be viewed..When user click on that Button, Snaps should be clicked and display it into Imageview of another activity. 详细地说,我的应用程序包含,One TextView(在顶部)显示活动名称和一个按钮(在底部)和屏幕的中间区域,应该查看相机预览..当用户单击该按钮时,应单击快照并将其显示在另一个活动的Imageview中。
I know that the following approach is used: 我知道使用以下方法:
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
startActivityForResult( intent, 0 );
But this approach if i used then my textview and button view is not displayed. 但是如果我使用这种方法则不会显示我的textview和按钮视图。
(Pls note that: I am using Android SDK 1.5 with HTC Hero) (请注意:我正在使用Android SDK 1.5和HTC Hero)
pls help me by suggestion of any article, site, or pdf. 请通过任何文章,网站或pdf的建议来帮助我。
thanx, paresh thanx,paresh
If you are trying to use the native camera, once the native camera is called it will control your view. 如果您尝试使用本机相机,一旦调用本机相机,它将控制您的视图。 However if you want to implement your own camera, then such a layout would be possible.
但是,如果您想要实现自己的相机,那么这样的布局是可能的。 Some good examples can be found here:
这里可以找到一些很好的例子:
http://www.brighthub.com/mobile/google-android/articles/43414.aspx http://www.brighthub.com/mobile/google-android/articles/43414.aspx
http://labs.makemachine.net/2010/03/simple-android-photo-capture/ http://labs.makemachine.net/2010/03/simple-android-photo-capture/
Goodluck! 祝好运!
All the instructions are at the JavaDoc of android.hardware.Camera at http://developer.android.com/reference/android/hardware/Camera.html : 所有说明都在http://developer.android.com/reference/android/hardware/Camera.html的android.hardware.Camera的JavaDoc中:
Important: Call release() to release the camera for use by other applications. 重要事项:调用release()以释放相机以供其他应用程序使用。 Applications should release the camera immediately in onPause() (and re-open() it in onResume()).
应用程序应立即在onPause()中释放相机(并在onResume()中重新打开()。
The SurfaceHolder is ususally implemented using SurfaceView SurfaceHolder通常使用SurfaceView实现
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.