Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8445143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:35:07+00:00 2026-06-10T09:35:07+00:00

I am using the following to scan barcode lines. private Camera mCamera; private CameraPreview

  • 0

I am using the following to scan barcode lines.

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);
                }
            });
    }

Then i am using the following Method to pass the intent to zxing sdk..

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.");
              }
          }
      }

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..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T09:35:09+00:00Added an answer on June 10, 2026 at 9:35 am

    Why do you want to take a picture and send it to zxing? You can directly ask Zxing app to open camera and read bar code. See my answer here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code to invoke Barcode scanner apps from Zing public Button.OnClickListener
I am using the following regex html.scan(Regexp.new(/Name:<\/td>(.*?)<\/td>/s)) to match the name [ Burkhart, Peterson
I'm using the following code to scan a folder for images: <?php $dir =
Using Ninject 2.2, I have the following failing test (simplified): public interface IGenericView<T> {
I'm trying to scan all stylesheets within DOM using following each() function $(link).each(function(){ $.get($(this).attr('href'),
I'm currently using the following code to scan files that have been uploaded as
Using following code I try to get updated list of checkbuttons' corresponding text values,
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am creating date using following code try { newdatetime = new DateTime(2012, 2,
I am using following configuration to properly fit image inside a scrollview. <?xml version=1.0

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.