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

  • Home
  • SEARCH
  • 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 7173943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:55:48+00:00 2026-05-28T15:55:48+00:00

I’ve been searching on how to add a barcode scanner to my app just

  • 0

I’ve been searching on how to add a barcode scanner to my app just to decode barcodes. I found a really good application I could intergrate to do that called “Zxing” but the only problem is, it has encoding and decoding but what i really want is only decoding so that I could limit what I use from the Zxing open source file.

Ive searched plenty of places couldnt find just decoding with zxing?

So my question is how could I use Zxing only to decode and not to encode aswell?
Example codes and step by step instructions will be really appreciated.

Thanks in Advanced!

  • 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-05-28T15:55:49+00:00Added an answer on May 28, 2026 at 3:55 pm

    The simplest way to do it is scan via Intent.

    here is some sample code:

    //This intent will ask the Barcode Scanner app to scan a code and give us the result
    Intent intent = new Intent("com.google.zxing.client.android.SCAN"); 
    
    /* you can optionally add an extra to the intent that tells it what type of code its looking for. Like this:
     * 
     * intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
     * 
     * If you don't put that in it will scan all types.
     */
    
     startActivityForResult(intent, 0);
    

    Then in your onActivityResult() you can get the scanned data like this:

     public void onActivityResult(int requestCode, int resultCode, Intent intent) {
        if (requestCode == 0) {
            if (resultCode == RESULT_OK) {
                // contents contains whatever was encoded
                String contents = intent.getStringExtra("SCAN_RESULT");
    
                // Format contains the type of code i.e. UPC, EAN, QRCode etc...
                String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
    
    
            }
        }
    
    }
    

    EDIT:

    The Intent model is built in to the very core idea of android. And it was put there for good reason. By having only 1 application that handles the scanning of barcodes and just returns the result to any other application that wants to make use of it, we get less wasted space.

    For instance, if a user has 5 apps that all scan different barcodes and do various things with them if all 5 of those apps include their own barcode decoding within their own app, the user now has 5 copies of the barcode reading functionality on their device wasting space.

    Another upside to the Intent model(specifically with barcode decoding) is that it allows your application to require fewer permissions. Because you no longer need access to the camera.

    It also makes everything much simpler for the developer. As you can see above the amount of effort it takes to integrate with zxing via intent is minimal. You’ll find that it is possible to re-use some portions of the Zxing project and include them within your application. But that it is much more difficult to get up and running.

    The ZXing project is open sourced so you are of course welcome to start picking through the source to figure out which classes you’ll need to manually copy to your project. I suggest that if you intend to go this route that on your first attempt you do not try to remove the encoding functions. Get the entire thing up and working, and then start removing stuff. It is likely that if you try to take only some subset of the project some things won’t function properly even though they don’t seem like they should be affected by what you’ve left out.

    One last bit of advice, I totally understand why you want to include this functionality within your own app(I’ve been there myself). But don’t make this decision lightly and do take some time to consider things like this: Lets say you do include this functionality within your own application. All goes well for a while. But after some time goes by you start to see strange errors popping up on some devices that cause them to be unable to use the scanning functionality of your app. Now you will be in a situation where you are going to have to try to debug and fix something that you did not create, and likely do not completely understand all of what is going on under the hood of. Whereas integrating with Intents makes it so that this debugging and fixing is done by the people who actually know every bit of how it works and what problems need addressed, and they work on their own update schedule. So this fixes will get out to the masses much quicker than you could probably get them out.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am writing an app with both english and french support. The app requests

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.