Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

ZXing BarcodeWriter issue (string to barcode)

$
0
0

I am trying to create a QR code from a string and not having any luck with either ZXing.Net or ZXing.Net.Mobile.Forms.

I am trying this code with ZXing.Net.Mobile.Forms nuget package.

using System.ComponentModel;
using Xamarin.Forms;
using ZXing;

namespace ZXing {
    [DesignTimeVisible(true)]
    public partial class MainPage : ContentPage {
        public MainPage() {
            InitializeComponent();
            var writer = new BarcodeWriter();
            writer.Format = BarcodeFormat.QR_CODE;
            var barcode = writer.Write("test string");
            // etc
        }
    }
}

I keep getting an error with the red squiggles underneath BarcodeWriter();

Error CS0305 Using the generic type 'BarcodeWriter' requires 1 type arguments ZXing

I also tried the following with no luck

var writer = new ZXing.Mobile.BarcodeWriter();

I have copied the required lines into the Android MainActivity.cs OnCreate and OnRequestPermissionsResult methods. No iOS or UWP, just Android here.

I'm not sure how to remedy this error.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>