Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class C03012 implements Runnable {
- C03012() {
- }
- public void run() {
- Camera.this.StartCamera();
- }
- }
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- this.startCameraHandler = new Handler();
- this.mScannerView = new ZXingScannerView(getActivity()) {
- };
- this.mScannerView.setResultHandler(this);
- return this.mScannerView;
- }
- public void onResume() {
- super.onResume();
- ResumeCamera();
- }
- public void handleResult(Result rawResult) {
- String sendTxt;
- sendTxt = rawResult.toString();
- ((MainActivity)getActivity()).recibirTexto(sendTxt);
- this.startCameraHandler.postDelayed(this.DelayedStartCamera, 0001);
- }
- private void ResumeCamera() {
- try {
- this.mScannerView.setAutoFocus(mAutoFocus);
- StartCamera();
- } catch (Exception e) {
- e.printStackTrace();
- try {
- mAutoFocus = false;
- this.mScannerView.setAutoFocus(mAutoFocus);
- StartCamera();
- } catch (Exception e2) {
- e2.printStackTrace();
- }
- }
- }
- private void StartCamera() {
- if (mCameraId != -1) {
- this.mScannerView.startCamera(mCameraId);
- } else {
- this.mScannerView.startCamera();
- }
- }
- private void StopCamera() {
- this.startCameraHandler.removeCallbacks(this.DelayedStartCamera);
- this.mScannerView.stopCamera();
- }
- public void onPause() {
- super.onPause();
- StopCamera();
- }
Add Comment
Please, Sign In to add comment