您好我正在尝试将相机参数设置如下
Parameters parameters = camera.getParameters();
List<String> flashModes = parameters.getSupportedFlashModes();
if(flashModes != null && flashModes.contains(Parameters.FLASH_MODE_TORCH))
{
parameters.setFlashMode(Parameters.FLASH_MODE_TORCH);
}
else if (flashModes != null && flashModes.contains(Parameters.FLASH_MODE_ON))
{
parameters.setFlashMode(Parameters.FLASH_MODE_ON);
}
camera.setParameters(parameters);
但我正在接近力量
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
java.lang.AbstractStringBuilder.deleteCharAt0(AbstractStringBuilder.java:249)
java.lang.StringBuilder.deleteCharAt(StringBuilder.java:360)
android.hardware.Camera$Parameters.flatten(Camera.java:1292)
android.hardware.Camera.setParameters(Camera.java:914)
com.example.VideoCapture.onClick(VideoCapture.java:282)
android.view.View.performClick(View.java:2485)
android.view.View$PerformClick.run(View.java:9080)
android.os.Handler.handleCallback(Handler.java:587)
android.os.Handler.dispatchMessage(Handler.java:92)
android.os.Looper.loop(Looper.java:130)
android.app.ActivityThread.main(ActivityThread.java:3683)
java.lang.reflect.Method.invokeNative(Native Method)
java.lang.reflect.Method.invoke(Method.java:507)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
dalvik.system.NativeStart.main(Native Method)
我不确定我哪里出错了。请帮助。
谢谢!