qrcode_scanner icon indicating copy to clipboard operation
qrcode_scanner copied to clipboard

Fatal exception when torch is clicked on a device which has no flashlight.

Open ChinHairSaintClair opened this issue 4 years ago • 5 comments

java.lang.RuntimeException: setParameters failed E/AndroidRuntime(24312): at android.hardware.Camera.native_setParameters(Native Method) E/AndroidRuntime(24312): at android.hardware.Camera.setParameters(Camera.java:2162) E/AndroidRuntime(24312): at com.uuzuche.lib_zxing.activity.CodeUtils.isLightEnable(CodeUtils.java:211) E/AndroidRuntime(24312): at com.shinow.qrscan.SecondActivity$1.onClick(SecondActivity.java:75) E/AndroidRuntime(24312): at android.view.View.performClick(View.java:7346) E/AndroidRuntime(24312): at android.view.View.performClickInternal(View.java:7312) E/AndroidRuntime(24312): at android.view.View.access$3200(View.java:846) E/AndroidRuntime(24312): at android.view.View$PerformClick.run(View.java:27801) E/AndroidRuntime(24312): at android.os.Handler.handleCallback(Handler.java:873) E/AndroidRuntime(24312): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(24312): at android.os.Looper.loop(Looper.java:214) E/AndroidRuntime(24312): at android.app.ActivityThread.main(ActivityThread.java:7156) E/AndroidRuntime(24312): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(24312): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) E/AndroidRuntime(24312): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975) I/Process (24312): Sending signal. PID: 24312 SIG: 9 Lost connection to device.

ChinHairSaintClair avatar Oct 15 '20 06:10 ChinHairSaintClair

this issue occured on my app too, is there any solution about this?

Cybernetics354 avatar Dec 01 '20 10:12 Cybernetics354

same problem here. it would be helpful if there was an option to disable/hide the flashlight.

tfbsza avatar Dec 08 '20 09:12 tfbsza

im ended up fork and change the java codes by myself, and i add some try catch on turn on/off callback so i can handle if there's exception occured.

file on SecondActivity.java

try {
  CodeUtils.isLightEnable(true);
  isLightOpen = true;
} catch (Exception e) {
  // Exception handler here
  Toast.makeText(getApplicationContext(), "Tidak bisa menyalakan senter", Toast.LENGTH_SHORT).show();
}

Cybernetics354 avatar Dec 08 '20 10:12 Cybernetics354

that is a good interim solution, thanks for posting it. this should be part of the baseline functionality of the package. maintaining custom forks can be problematic in terms of future updates and fixes.

tfbsza avatar Dec 08 '20 11:12 tfbsza

yeah i think so, in case you want to fix this issue ASAP, you can use that alternative. i've made a pull request for this. but i can't wait for the maintainer accept this so right now im using custom fork until it accepted or fixed by them.

and also sorry for my bad english :")

Cybernetics354 avatar Dec 08 '20 20:12 Cybernetics354