上传者: zzq779080805
|
上传时间:2024/7/14 20:08:41
|
文件大小:8KB
|
文件类型:zip
usb扫描枪数据获取解析
publicclassChiceScanGunActivityextendsActivity{@OverrideprotectedbooleanonKeyEvent(KeyEventevent){if(event.getAction()==KeyEvent.ACTION_DOWN){intkeyCode=event.getKeyCode();if(keyCode<=6){returnfalse;}if(mScanGun.isMaybeScanning(keyCode,event)){returntrue;}}returntrue;}@OverridepublicvoidonCreate(){super.onCreate();//TODOmScanGun=newScanGun(newScanGunCallBack(){@OverridepublicvoidonScanFinish(StringscanResult){if(!TextUtils.isEmpty(scanResult)){Toast.makeText(DetectionService.this.getBaseContext(),"无界面监听扫描枪数据:"+scanResult,Toast.LENGTH_SHORT).show();}}});mScanGun.setMaxKeysInterval(50);}}