We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onScanSuccess 里执行UI操作,不报错,但会导致ANR,里面另起UI线程执行UI操作则没问题
@OverRide public void onScanSuccess(final String result) { Log.e("onScanSuccess", result); mSoundPoolUtil.play(); mScanView.stopScan();
//不报错,不弹框,执行这个后,按返回 ANR new AlertDialog.Builder(ScanActivity.this).setTitle("最新通知").setMessage(result) .setCancelable(true).setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { mScanView.startScan(); // 显示扫描框,并开始识别 } }).show(); //不报错,弹框,执行这个后,按返回 正常 runOnUiThread(new Runnable() { @Override public void run() { new AlertDialog.Builder(ScanActivity.this).setTitle("最新通知").setMessage(result) .setCancelable(true).setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { mScanView.startScan(); // 显示扫描框,并开始识别 } }).show(); } });
}
The text was updated successfully, but these errors were encountered:
其实我觉得这样没啥问题,在子线程返回的话有更大的操作空间,可以操作自己需要处理的耗时任务,而且转到主线程的话我的操作和你的也差不多。
Sorry, something went wrong.
No branches or pull requests
onScanSuccess 里执行UI操作,不报错,但会导致ANR,里面另起UI线程执行UI操作则没问题
@OverRide
public void onScanSuccess(final String result) {
Log.e("onScanSuccess", result);
mSoundPoolUtil.play();
mScanView.stopScan();
}
The text was updated successfully, but these errors were encountered: