1

I know I can fire an intent and start the camera, but I want to do something else. And I need the camera included in my own activity.

Let say this is an activity with black background, and the down part is some buttons or whatever and the upper part the gray area needs to be some view that will show the view from the camera. All I want to do is to stream the camera output in to my own view as a part of my own activity.

Is this possible ?, and if it is how can I do this.

Thanks, enter image description here

4

1 回答 1

0

对的,这是可能的。但是,这需要相当长的代码来完成,所以我建议您查看Android Developers中的一个很棒的教程,而不是详细说明。如您所见,在 Android 中有两种使用相机的方法 - 触发 Intent 或实现自定义相机。构建相机应用程序部分提供了为您的相机定制外观的明确指南。简而言之,您需要

  • 检查相机是否可用
  • 开火
  • (如有必要)检查支持的功能
  • 实现预览(即显示来自相机的实时成像)
  • 将该预览放置到您的自定义布局中
  • 捕获并保存图像(根据您的问题似乎无关紧要)
  • 完成后释放相机!
于 2011-11-15T12:00:04.347 回答