Get the latest Dynamsoft SDK package for Android - DynamsoftBarcodeReader.aar.
- library: convert DynamsoftBarcodeReader.aar to a Xamarin.Android Java Bindings Library.
- app: a Xamarin Android project for reading barcode.
- Build the library project to generate DBRAndroid.dll in Visual Studio 2015.
- Open the Android project and add the reference.
- Build the Android project and run the app on your mobile device or emulator.
using Com.Dynamsoft.Barcode;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate {
Bitmap image = BitmapFactory.DecodeResource(Resources, Resource.Drawable.qr);
BarcodeReader barcodeReader = new BarcodeReader("license");
ReadResult result = barcodeReader.ReadSingle(image, Barcode.QrCode);
button.Text = string.Format("{0} clicks! barcode result: {1}", count++, result.Barcodes[0].DisplayValue);
};
}