お気づきかもしれませんが、Android フォンのカメラは、最小化すると動作しなくなります (たとえば、新しいアプリケーションを起動したとき)。私の質問は次のとおりです: Android カメラを使用してアプリを作成する方法はありますか? それとも、MediaStore を使用せずにそのようなカメラを作成する場合にのみ可能でしょうか? 私に役立つリンクやコードを共有していただければ幸いです。前もって感謝します。
質問する
2327 次
1 に答える
1
これに対する答えは、使用しなければならないということだと思います
public final void setPreviewTexture (SurfaceTexture surfaceTexture)
Added in API level 11
Sets the SurfaceTexture to be used for live preview.
Either a surface or surface texture is necessary for preview,
and preview is necessary to take pictures.
https://developer.android.com/reference/android/hardware/Camera.htmlから。そしてhttps://developer.android.com/reference/android/graphics/SurfaceTexture.htmlから:
The image stream may come from either camera preview or video decode.
A SurfaceTexture may be used in place of a SurfaceHolder when specifying the
output destination of a Camera or MediaPlayer object. Doing so will cause all the
frames from the image stream to be sent to the SurfaceTexture object rather than
to the device's display.
本当にこれを試してコードを送りたいのですが、ジンジャーブレッドより最近の電話はなく、これはハニカムで導入されました。
surface
アクティビティに関連付けられたを使用すると、アクティビティが最小化されているsurfaceDestroyed
間onPause
とonStop
最小化されているときに呼び出されますが、奇妙なことに、電話がスリープ状態になっているときではありません。SurfaceHolderコールバックはアクティビティのライフサイクルにどのように関連していますか。surfaceTexture
しかし、私はaがこのように破壊されないことを望みます。
于 2012-12-15T09:58:00.107 に答える