Note that there are some explanatory texts on larger screens.

plurals
  1. POFocus and scan barcode lines from android Camera
    primarykey
    data
    text
    <p>I am using the following to scan barcode lines.</p> <pre><code>private Camera mCamera; private CameraPreview mPreview; public static final int MEDIA_TYPE_IMAGE = 1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.newmain); Button captureButton = (Button) findViewById(R.id.button_capture); // Create an instance of Camera mCamera = getCameraInstance(); // Create our Preview view and set it as the content of our activity. mPreview = new CameraPreview(this, mCamera); FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); preview.addView(mPreview); final PictureCallback mPicture = new PictureCallback() { public void onPictureTaken(byte[] data, Camera camera) { Intent intent = new Intent("http://zxing.appspot.com/scan"); // Intent intent = new Intent("com.google.zxing.client.android.SCAN"); intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); startActivityForResult(intent, 0); } }; captureButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent("http://zxing.appspot.com/scan"); // Intent intent = new Intent("com.google.zxing.client.android.SCAN"); intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); startActivityForResult(intent, 0); // get an image from the camera // System.out.println("Photo Taking!"); // mCamera.takePicture(null, null, mPicture); } }); } </code></pre> <p>Then i am using the following Method to pass the intent to zxing sdk..</p> <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { TextView tvStatus=(TextView)findViewById(R.id.tvStatus); TextView tvResult=(TextView)findViewById(R.id.tvResult); if (resultCode == RESULT_OK) { String contents = intent.getStringExtra("SCAN_RESULT"); String format = intent.getStringExtra("SCAN_RESULT_FORMAT"); tvStatus.setText(intent.getStringExtra(format)); tvResult.setText(intent.getStringExtra(contents)); Toast.makeText(getApplicationContext(), "Content:" + contents + " Format:" + format , Toast.LENGTH_LONG).show(); } else if (resultCode == RESULT_CANCELED) { tvStatus.setText("Press a button to start a scan."); tvResult.setText("Scan cancelled."); } } } </code></pre> <p>But i am not able to put camera focus on barcode lines.. I would appreciate, if i get some help on how to focus camera on barcode lines, so that i can pass the intent to zxing sdk.. Also, comments on Some Android sdk to scan barcode lines would be appreciated.. Thanx in advance..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload