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 8721005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:09:07+00:00 2026-06-13T07:09:07+00:00

I am using Zxing library to generate a barcode in my Android application Intent

  • 0

I am using Zxing library to generate a barcode in my Android application

Intent intent = new Intent("com.google.zxing.client.android.ENCODE");

intent.putExtra("ENCODE_FORMAT", "UPC_A");
intent.putExtra("ENCODE_DATA", "55555555555");

startActivityForResult(intent,0);

Is there anyway to save the generated image in my application which is calling Zxing? I see that in my onActivityResult I get intent null.

Thanks in advance for your help

  • 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-13T07:09:08+00:00Added an answer on June 13, 2026 at 7:09 am

    Take the views cache and save it in bitmap something like this

    View myBarCodeView = view.getRootView()
    //Else this might return null
    myBarCodeView.setDrawingCacheEnabled(true)
    //Save it in bitmap
    Bitmap mBitmap = myBarCodeView.getDrawingCache()
    

    OR
    draw your own barcode or QR CODE

    //Change the writers as per your need
    private void generateQRCode(String data) {
        com.google.zxing.Writer writer = new QRCodeWriter();
        String finaldata =Uri.encode(data, "ISO-8859-1");
        try {
            BitMatrix bm = writer.encode(finaldata,BarcodeFormat.QR_CODE, 350, 350);
            mBitmap = Bitmap.createBitmap(350, 350, Config.ARGB_8888);
            for (int i = 0; i < 350; i++) {
                for (int j = 0; j < 350; j++) {
                    mBitmap.setPixel(i, j, bm.get(i, j) ? Color.BLACK: Color.WHITE);
                }
            }
        } catch (WriterException e) {
            e.printStackTrace();
        }
        if (mBitmap != null) {
            mImageView.setImageBitmap(mBitmap);
        }
    }
    public void generateBarCode(String data){
        com.google.zxing.Writer c9 = new Code128Writer();
        try {
            BitMatrix bm = c9.encode(data,BarcodeFormat.CODE_128,350, 350);
            mBitmap = Bitmap.createBitmap(350, 350, Config.ARGB_8888);
    
            for (int i = 0; i < 350; i++) {
                for (int j = 0; j < 350; j++) {
    
                    mBitmap.setPixel(i, j, bm.get(i, j) ? Color.BLACK : Color.WHITE);
                }
            }
        } catch (WriterException e) {
            e.printStackTrace();
        }
        if (mBitmap != null) {
            mImageView.setImageBitmap(mBitmap);
        }
    }
    

    Once you get the bitmap image just save it

    //create a file to write bitmap data
        File f = new File(FilePath, FileName+".png");
        f.createNewFile();
    
        //Convert bitmap to byte array
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ImageBitmap.compress(CompressFormat.PNG, 0, bos);
        byte[] bytearray = bos.toByteArray();
    
        //Write bytes in file
        FileOutputStream fos = new FileOutputStream(f);
        fos.write(bytearray);
        fos.flush();
        fos.close();
    

    You can also check a small library from github that i had created to create Barcode or QR Code

    GZxingEncoder   Encoder = GZxingEncoder.getInstance();
    Encoder.initalize(this);
    //To generate bar code use this
    Bitmap bitmap = Encoder.generateBarCode_general("some text")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an application to generate a barcode USing Zxing as library.
I am using Zxing client for developing BarCode Scanner for android. But I guess
am able to generate barcode using zxing barcode library, am using ... String text
I'm currently using ZXing in my Android app to generate a one-dimension barcode (EAN_13
I am using zxing library, where I have built ZXing Android using Eclipse and
I'm building the Android scanning app using zxing library. I have built the zxing
Im currently using the Barcode Scanner from the open source library Zxing in my
Possible Duplicate: Using ZXing to create an android barcode scanning app I know it
i am using zxing for barcode reader into my iphone application .But it is
I'm making a Android application to scan 2D barcodes. I'm using the Zxing source

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.