我发现的是,有些装置需要表面上听从LED。
SurfaceView preview = (SurfaceView) findViewById(R.id.PREVIEW);
SurfaceHolder mHolder = preview.getHolder();
mHolder.addCallback(this);
Camera mCamera = Camera.open();
mCamera.setPreviewDisplay(mHolder);
// Turn on LED
Parameters params = mCamera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_TORCH);
mCamera.setParameters(params);
mCamera.startPreview();
...
// Turn off LED
Parameters params = mCamera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_OFF);
mCamera.setParameters(params);
mCamera.stopPreview();
mCamera.release();
你的活动需要执行水稻。 反馈:
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {}
public void surfaceCreated(SurfaceHolder holder) {
mHolder = holder;
mCamera.setPreviewDisplay(mHolder);
}
public void surfaceDestroyed(SurfaceHolder holder) {
mCamera.stopPreview();
mHolder = null;
}
The surfaceview has to be visible, android:visibility="invisible"
or a height and width of 0 won t work. Unfortunately I didn t find a good solution to hide it, so I
just gave it a size of 1x1dip and positioned it underneath a button..
**(对上述段落加以扩充[但认为其有用]不够回答] 在你目前内容观点的XML中,你希望:
<SurfaceView
android:id="@+id/PREVIEW"
android:layout_width="1dip"
android:layout_height="1dip"/>
如果你在“亲属关系”内有这种联系,那么你也能够使ParentLeft/Bottom在一角 t。 这种方法适用于我的银河Nexus,但它为Droid X(更新621条,任何一条路)提出了一个已知的问题(电话线),并且没有处理地雷问题。 答案大, t!