Skip to content Skip to sidebar Skip to footer

Intergrate Camera Without Deprecated Methods And Backwards Support

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

Solution 1:

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.

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.

Solution 2:

I think you can implement the camera function in both sets of API and check the device`s build version first then decided to call which one implementation.

eg:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
      openCameraNewAPI();
}else{
      openCameraOldAPI();
}

Post a Comment for "Intergrate Camera Without Deprecated Methods And Backwards Support"