各位朋友,我想用手机点灯一个LED灯,要怎么操作。大神给点思路。
------解决方案--------------------
private void OpenLightOn() {
if (null == m_Camera) {
m_Camera = Camera.open();
}
Camera.Parameters parameters = m_Camera.getParameters();
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
m_Camera.setParameters(parameters);
m_Camera.autoFocus(new Camera.AutoFocusCallback() {
public void onAutoFocus(boolean success, Camera camera) {
}
});
m_Camera.startPreview();
}
private void CloseLightOff() {
if (m_Camera != null) {
m_Camera.stopPreview();
m_Camera.release();
m_Camera = null;
}
}