IDAutomation.com, Inc., Computers Hardware, Software & Services, Tampa, FL Contact IDAutomationView your cart in the IDAutomation Store  
Loading

IDAutomation will be closed November 27th & 28th for Thanksgiving.

Home > Font Encoders > Android Barcode Integration with Fonts

Barcode Generator for Android Platform

Scan This QR Code with Your Smart Phone to Download the Android Barcode Generator.
Scan the barcode above to Download the App in the Android Market.

IDAutomation's Java Barcode Font Encoders are compatible with Android 2.2 or greater and can be used in conjunction with IDAutomation's barcode fonts to encode data strings and produce readable barcodes on Android devices.

Android Barcode Font Implementation & Compatibility
Android Barcode Symbology Compatibility
Linear Barcodes Code 39, Extended Code 39, Code 128 (with character sets Auto, A, B & C), GS1-128 (aka: UCC/EAN-128), USS-128, NW7, Interleaved 2 of 5, Codabar, UPC-A, UPC-E, MSI, EAN-8, EAN-13, Code 11, Code 93, ITF, Bearer Bars, PLANET, USPS OneCode 4CB, Intelligent Mail and Postnet.
2D PDF417 PDF417 with text and base256 (byte) encoding. AIM Specification USS PDF417.
2D Data Matrix Data Matrix with ECC200 error correction. Encoding modes of Text, ASCII, C40 and Base256 (byte) encoding are supported. AIM Specification ISS Data Matrix.
2D MaxiCode MaxiCode with support for modes 2-6. AIM Specification ISS MaxiCode.
2D Aztec Aztec with support for appending messages across multiple symbols, and scanner initialization.
2D QR-Code QR-Code with support for Byte, Numeric, and Alpha-numeric encoding modes, and automatic Version selection.
GS1 DataBar (RSS) GS1 DataBar Truncated, Stacked, Stacked Omni-directional, Limited, Expanded, Expanded Stacked Omni-directional.
Andriod Barcode Font Encoder AppInstalling Android Barcode Fonts
  1. The following steps assume that Eclipse is being used and that the Android SDK and plug-in have already been installed and configured.
  2. Download and unzip the Java Font Encoder into a directory on the development computer.
    (Java encoders for 2D barcode fonts are included in their respective font packages.)
  3. In Eclipse, open the properties of the project.
  4. Select the Java Build Path option.
  5. Import the encoder.
    • When importing a class file, such as in the PDF417 Java font encoder, click the Add External Class Folder... option, then navigate to the parent folder containing the package.
    • When importing a jar file, click the Add External JARs button. Navigate to the jar file and click OK.

      Import the Java Font Encoder in the Properties Window
       
  6. Create a Fonts folder in the assets directory of your android project.
  7. Add the true type barcode font files that will be used to create the barcode such as the IDAutomationC128.ttf. These fonts will be applied programmatically to a TextView using the Typeface class, see source code examples.

    Truetype Fonts for 2D, PDF417 and Code 128 Barcodes
     
  8. Download the sample android project for a working example.

    Download the Sample Android Barcode Generator App

Android Barcode Source Code Examples

Once installed, several different method parameters and properties may be used from the java font encoder to encode the input.

Using the Java Barcode Generator for Android

The method to use from the encoder will depend on the barcode type that will be generated. Here are some implementation examples of using the java font encoder for android with a specified barcode font.

Applying the Barcode Font to a Text View

//used to set the text views to the barcode fonts protected
Typeface BarcodeFontFace;
//set the font of the text box to the Code 128 font
BarcodeFontFace = Typeface.createFromAsset(getAssets(),"Fonts/IDAutomationC128.ttf");
BarcodeTextView.setTypeface(BarcodeFontFace);

Code 128 Implementation Example

//set the font of the text box to the Code 128 font
Typeface
BarcodeFontFace = Typeface.createFromAsset(getAssets(),"Fonts/IDAutomationC128.ttf");
BarcodeTextView.setTypeface(BarcodeFontFace);
//initialize the Linear encoder to generate the encoded string
LinearFontEncoder BCEnc = new LinearFontEncoder();
//set the barcode text view to the BarcodeView ID
TextView BarcodeTextView = (TextView) findViewById(R.id.BarcodeView);
//set the text of the TextView to the encoded string
BarcodeTextView.setText(String.format("%s",BCEnc.Code128(barcodedata,true)));

QR Code Implementation Example

//set the font of the text box to the 2D barcode font
Typeface 
BarcodeFontFace = Typeface.createFromAsset(getAssets(),"Fonts/IDAutomation2D.ttf");
BarcodeTextView.setTypeface(BarcodeFontFace);
//initialize the Linear encoder to generate the encoded string
QRCodeEncoder QREnc = new QRCodeEncoder();
//set the barcode text view to the BarcodeView ID
TextView BarcodeTextView = (TextView) findViewById(R.id.BarcodeView);
//set the text of the TextView to the encoded string
BarcodeTextView.setText(String.format("%s", 
QREnc.FontEncode(ReplaceCR(barcodedata), true, 0, 0, 0)));

PDF417 Implementation Example

//set the font of the text box to the PDF417 font and adjust the font size.
Typeface
BarcodeFontFace = Typeface.createFromAsset(getAssets(),"Fonts/IDAutomationPDF417n2.ttf");
BarcodeTextView.setTypeface(BarcodeFontFace);
BarcodeTextView.setTextSize(12);
//initialize the PDF417 encoder to generate the encoded string
PDF417Encoder PDFEnc = new PDF417Encoder();
//set the barcode text view to the BarcodeView ID
BarcodeTextView = (TextView) findViewById(R.id.BarcodeView);
//adjust the columns, and set the text of the TextView to the encoded string
PDFEnc.setPDFColumns(3);
BarcodeTextView.setText(String.format("%s",PDFEnc.fontEncode(ReplaceCR(barcodedata))));

Method to Remove Extra Carriage Returns for 2D Barcode Implementations

protected String ReplaceCR(String data)
{
   return data.replaceAll("\n", String.valueOf((char)13));
}

Code 128 Barcode FAQ | QR Code Barcode FAQ | PDF417 Barcode FAQ

Related Products & Information

The following product and information links relate to this product and may be of interest:

Android Barcode Integration Support

Free product support is available by reviewing the font problems and solutions information that IDAutomation has documented and by searching resolved public forum threads.

Pre-sales and existing customer support is available by contacting IDAutomation, and additional technical support may be attained with the purchase of the one year Priority Support and Upgrade Subscription.

 © Copyright 2014 IDAutomation.com, Inc., All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us
Training Videos on YouTube Join us on Google Plus Join us on LinkedIn Follow us on Twitter Like us on Facebook
Over 70% of Fortune 100 companies use IDAutomation's products to automate their businesses.