2012-01-11 3 views
1

qr 코드 리더 앱을 만들고 있습니다. 버튼을 클릭하면 카메라보기가 열립니다. 그런 다음 결과에 따라 다음 화면으로 이동하지만 화면을 열면 두 번째 오류가 발생합니다. CamController : get res failed : _camConfigHandle이 유효하지 않습니다.Blackberry 오류 _camConfigHandle이 잘못되었습니다.

편집 : 나는 스캐너를 제거하고 다음 화면

UiApplication.getUiApplication().invokeLater(new Runnable() { 
          public void run() { 
           try { 
            _scanner.getPlayer().stop(); 

           } catch (MediaException e) { 
            e.printStackTrace(); 
           } 
           _scanner.getPlayer().close(); 
           System.out.println("closeScan"); 
           _scanner.getPlayer().deallocate(); 
           System.out.println("deallocateScan"); 
           System.out.println("deleteAllScan"); 
           UiApplication.getUiApplication().popScreen(_barcodeScreen); 
          } 
         }); 

로 이동이 코드를 시도해야하고이 사전에

private void scanBarcode() { 

     if (_barcodeScreen == null) { 
      Hashtable hints = new Hashtable(); 
      Vector formats = new Vector(); 
      formats.addElement(BarcodeFormat.QR_CODE); 
      hints.put(DecodeHintType.POSSIBLE_FORMATS, formats); 
      hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); 
      BarcodeDecoder decoder = new BarcodeDecoder(hints); 
      try { 
       _scanner = new BarcodeScanner(decoder, new MyBarcodeDecoderListener()); 
       _barcodeScreen = new MyBarcodeScannerViewScreen(_scanner); 

      } catch (Exception e) { 
      System.out.println("error="+e.toString()); 
       return; 
      } 
     } 

     try { 
      _scanner.startScan(); 
      UiApplication.getUiApplication().pushScreen(_barcodeScreen); 
     } catch (Exception e) { 
      System.out.println("error1="+e.toString()); 
     } 

    } 

감사를 스캔 내 코드입니다.

+0

일부 코드를 게시하십시오. 그 방법을 도와주기가 더 쉬울거야 –

+0

나는 질문을 업데이트했다. –

답변

1

카메라를 제대로 닫고 있습니까? 다음과 같은 방법으로 카메라를 닫으려면 유사한 일을하십시오.

//close the scanner 
public void closeScanner() 
{ 
if (this.player != null) { 
    try { 
    this.player.stop(); 
    } catch (MediaException e) { 
     //handle exception 
    Log.Error("Exception stopping player: " + e); 
    } 
    //de allocate and close player 
    this.player.deallocate(); 
    this.player.close(); 
} 
} 
관련 문제