我有qrReader應用程序,所以在ActivityResult我寫入意圖到相機,如果我有迴應我想要的是有可能在意圖後自動拍攝照片和自動對焦後??(我應該有什麼增加對自動捕獲)從相機自動捕捉圖像?
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
IntentIntegrator intentIntegrator = new IntentIntegrator(activity);
intentIntegrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE_TYPES);
intentIntegrator.setPrompt("Scan");
intentIntegrator.setCameraId(0);
intentIntegrator.setBeepEnabled(false);
intentIntegrator.setBarcodeImageEnabled(false);
intentIntegrator.initiateScan();
}
});
}
@Override
protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
final IntentResult result = IntentIntegrator.parseActivityResult(requestCode,resultCode,data);
if(result!= null){
if(result.getContents()==null){
Toast.makeText(getApplicationContext(),"you canceled the scanning",Toast.LENGTH_LONG).show();
}
else {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
textView.setText(result.getContents());
startActivityForResult(intent, TAKE_PICTURE);
}
}
super.onActivityResult(requestCode, resultCode, data);
}
發佈您的代碼,所以我們可以提出修改建議 – Akshay
加入請檢查它還有什麼要補充拍攝的圖片自動 – EasyE