Skip to content

Instantly share code, notes, and snippets.

@geirsagberg
Created October 29, 2014 16:15
Show Gist options
  • Save geirsagberg/4f635dad675ea03a3c1c to your computer and use it in GitHub Desktop.
Save geirsagberg/4f635dad675ea03a3c1c to your computer and use it in GitHub Desktop.
MvvmCross bindable BarCodeView for Android with ZXing
public class BarCodeView : ImageView
{
private string _code;
public string Code
{
get { return _code; }
set
{
if (_code != value)
{
GenerateNewBarcode(value);
}
_code = value;
}
}
public BarCodeView(Context context, IAttributeSet attrs)
: base(context, attrs)
{
}
private void GenerateNewBarcode(string code)
{
Bitmap bitmap = Mvx.Resolve<IBarcodeWriter>().Write(code);
SetImageBitmap(bitmap);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment