集成摄像头,没有过时的方法和向后支持 [英] Intergrate camera without deprecated methods and backwards support

查看:89
本文介绍了集成摄像头,没有过时的方法和向后支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想构建一个使用设备的前置摄像头将当前图像投影到SurfaceView的应用程序.到目前为止,我发现的所有教程都是通过使用android.hardware软件包中的Camera对象来实现的.

I want to build an application where the front camera of the device is used to project the current image to a SurfaceView. All the tutorials I found so far implement this by using a Camera object from the android.hardware package.

但是,似乎不推荐使用此方法.在尝试 Android的新"方式来实现此功能时,文档,我得到的警告是它只能与API级别21一起使用,这是没有用的.

This method, however, seems to be deprecated. When trying the 'new' preferred way to implement this feature following the Android documentation, I get the warning it can only be used with API level 21, which is pretty useless.

所以我想知道当前在应用程序中实现相机功能的首选方法.还是可能有一些低于21的API支持库?

So I would like to know the currently preferred way to implement camera functionality in an application. Or is there maybe some support library for API levels lower than 21?

谢谢.

推荐答案

已弃用的接口并不意味着您不应使用它.这意味着您应该知道它将在未来逐步淘汰.

Deprecated interface does not mean you should not use it. It means you should know that it will be phasing out in the future.

通常,如果可能的话,最好使用较新的界面,以避免以后再更新软件.

As a general rule, it is better to use a newer interface if possible, in order to avoid the need to update the software later.

API级别21尚未拥有足够大的市场份额这一事实意味着您现在最好使用旧界面,并请记住,在一两年之内,您可能需要更新实现

The fact that API level 21 does not yet have a large enough market share means that you are probably better off using the old interface for now, and keep in mind that in a year or two, you may need to update the implementation.

这篇关于集成摄像头,没有过时的方法和向后支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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