1
我想为我的摩托罗拉火xt-530创建闪光灯火炬应用程序。 检查这个响应切换按钮的代码。在摩托罗拉火xt-530中找不到闪光模式火炬xt-530
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
if (getApplicationContext().getPackageManager().hasSystemFeature(
PackageManager.FEATURE_CAMERA_FLASH)) {
camera = Camera.open();
params = camera.getParameters();
List<String> flashModes = params.getSupportedFlashModes();
if (flashModes == null) {
Toast.makeText(getApplicationContext(), "No Flash Found",
Toast.LENGTH_SHORT).show();
} else {
camera.startPreview();
if (flashModes.contains(Parameters.FLASH_MODE_TORCH)) {
Toast.makeText(getApplicationContext(),
"Torch Mode Found", Toast.LENGTH_SHORT).show();
params.setFlashMode(Parameters.FLASH_MODE_TORCH);
camera.setParameters(params);
camera.takePicture(null, null, null);
} else {
Toast.makeText(getApplicationContext(),
"Torch Mode Not Found", Toast.LENGTH_SHORT).show();
}
}
} else {
Toast.makeText(getApplicationContext(), "Not Available",
Toast.LENGTH_SHORT).show();
}
} else {
camera.stopPreview();
camera.release();
Toast.makeText(getApplicationContext(), "Not Checked",
Toast.LENGTH_SHORT).show();
}
哪些敬酒火炬模式找不到。没有根。 请帮助我。
我可以使用FLASH_MODE_ON做些什么吗? 使用循环或线程? – 2012-08-18 05:43:01