共用方式為


Camera.Reconnect Method

Definition

Caution

deprecated

Reconnects to the camera service after another process used it.

[Android.Runtime.Register("reconnect", "()V", "")]
[System.Obsolete("deprecated")]
public void Reconnect ();
[<Android.Runtime.Register("reconnect", "()V", "")>]
[<System.Obsolete("deprecated")>]
member this.Reconnect : unit -> unit
Attributes

Exceptions

if a connection cannot be re-established (for example, if the camera is still in use by another process).

Remarks

Reconnects to the camera service after another process used it. After #unlock() is called, another process may use the camera; when the process is done, you must reconnect to the camera, which will re-acquire the lock and allow you to continue using the camera.

Since API level 14, camera is automatically locked for applications in android.media.MediaRecorder#start(). Applications can use the camera (ex: zoom) after recording starts. There is no need to call this after recording starts or stops.

If you are not recording video, you probably do not need this method.

Java documentation for android.hardware.Camera.reconnect().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to