Android - 拍摄照片
在我的应用程序中,我必须实现本机相机活动,我必须启动相机并拍照。
详细, 我的应用程序包含一个 TextView(顶部)来显示活动名称和一个 Button(底部),在屏幕的中间区域,应该查看相机预览。当用户单击该按钮时,应该单击 Snap 并显示它进入另一个活动的 Imageview。
我知道使用以下方法:
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
startActivityForResult( intent, 0 );
但是如果我使用这种方法,那么我的文本视图和按钮视图不会显示。
(请注意:我正在使用 Android SDK 1.5 和 HTC Hero)
请通过任何文章、网站或 pdf 的建议来帮助我。
谢谢帕雷什
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.
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.
(Pls note that: I am using Android SDK 1.5 with HTC Hero)
pls help me by suggestion of any article, site, or pdf.
thanx, paresh
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您尝试使用本机相机,一旦调用本机相机,它将控制您的视图。但是,如果您想实现自己的相机,那么这样的布局是可能的。可以在此处找到一些很好的示例:
http://www. Brighthub.com/mobile/google-android/articles/43414.aspx
http://labs.makemachine.net/2010/03/simple-android-photo-capture/
你好运!
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://labs.makemachine.net/2010/03/simple-android-photo-capture/
Goodluck!
所有说明均位于 android.hardware.Camera 的 JavaDoc http:// developer.android.com/reference/android/hardware/Camera.html:
重要提示:调用release()来释放相机以供其他应用程序使用。应用程序应在 onPause() 中立即释放相机(并在 onResume() 中重新打开()它)。
SurfaceHolder 通常使用 SurfaceView
实现
All the instructions are at the JavaDoc of android.hardware.Camera at http://developer.android.com/reference/android/hardware/Camera.html:
Important: Call release() to release the camera for use by other applications. Applications should release the camera immediately in onPause() (and re-open() it in onResume()).
The SurfaceHolder is ususally implemented using SurfaceView