android - Android Camera API预览显示

我对将预览与Android的原始Camera API结合使用存在疑问。

有问题的API是setPreviewDisplay() 在API的源代码( link )中,它表示以下内容:

   This method must be called before startPreview().  The
   one exception is that if the preview surface is not set (or set to null)
   before startPreview() is called, then this method may be called once
   with a non-null parameter to set the preview surface.  (This allows
   camera setup and surface creation to happen in parallel, saving time.)
   The preview surface may not otherwise change while preview is running.

我想问一下如何使用这种例外情况。 该评论是否暗示我们可以执行以下操作:

 camera.setPreviewDisplay(null);
 camera.startPreview();
 // later
 camera.setPreviewDisplay(surfaceHolder);

转载请注明来自askonline.tech,本文标题:android - Android Camera API预览显示


 Top