FileDocCategorySizeDatePackage
CameraExceptionHandler.javaAPI DocAndroid 5.1 API4152Thu Mar 12 22:22:48 GMT 2015com.android.ex.camera2.portability

CameraExceptionHandler

public class CameraExceptionHandler extends Object
A handler for all camera api runtime exceptions. The default behavior is to throw the runtime exception.

Fields Summary
private android.os.Handler
mHandler
private CameraExceptionCallback
mCallback
Constructors Summary
public CameraExceptionHandler(CameraExceptionCallback callback, android.os.Handler handler)
Construct a new instance of {@link CameraExceptionHandler} with a custom callback which will be executed on a specific {@link Handler}.

param
callback The callback which will be invoked.
param
handler The handler in which the callback will be invoked in.


                   
        
           
          
                       
           
    

                                                 
         
        mHandler = handler;
        mCallback = callback;
    
public CameraExceptionHandler(android.os.Handler handler)
Construct a new instance of {@link CameraExceptionHandler} with a default callback which will be executed on a specific {@link Handler}.

param
handler The handler in which the default callback will be invoked in.

        mHandler = handler;
    
Methods Summary
public voidonCameraError(int errorCode)
Invoke @{link CameraExceptionCallback} when an error is reported by Android camera framework.

param
errorCode An integer to represent the error code.
see
android.hardware.Camera#setErrorCallback(android.hardware.Camera.ErrorCallback)

        mHandler.post(new Runnable() {
            @Override
            public void run() {
                mCallback.onCameraError(errorCode);
            }
        });
    
public voidonCameraException(java.lang.RuntimeException ex, java.lang.String commandHistory, int action, int state)
Invoke @{link CameraExceptionCallback} when a runtime exception is thrown by Android camera framework.

param
ex The runtime exception object.

        mHandler.post(new Runnable() {
            @Override
            public void run() {
                mCallback.onCameraException(ex, commandHistory, action, state);
            }
        });
    
public voidonDispatchThreadException(java.lang.RuntimeException ex)
Invoke @{link CameraExceptionCallback} when a runtime exception is thrown by

{link
DispatchThread}.
param
ex The runtime exception object.

        mHandler.post(new Runnable() {
            @Override
            public void run() {
                mCallback.onDispatchThreadException(ex);
            }
        });