友達私はバーコードスキャナーを開発しようとしています。作業フローは次のとおりです。ユーザーがスキャンボタンをクリックすると、バーコードの画像をキャプチャし、この画像をスキャンして結果を表示する必要があります。問題は、スキャンボタンをクリックすると、「バーコードスキャナーをインストールしてください」というメッセージが表示されることです。このアプローチを使用します。私のコードで何を変更するのですか????、これが私のコードです。
IntentIntegrator integrator = new IntentIntegrator(BarcodeScanner.this);
integrator.initiateScan();
scan_btn = (Button)findViewById(R.id.Barcode_Scan_Button);
scan_btn.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent scanIntent= new Intent("com.google.zxing.client.android.SCAN");
scanIntent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(scanIntent, 0);
}
});
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
result_text.setText(intent.getStringExtra("SCAN_RESULT"));
}
else
result_text.setText("Scan cancelled.");
}
}