c# - I am not able see generated QR Code Image in Xamarin using ZXing.NET.Mobile -


please me ,

i not able see generated qr code image. doing wrong !

i have used xamarin forms . have used image populated in stacklayout

public class barcodepage : contentpage {     public barcodepage ()     {         image img = new image {             aspect = xamarin.forms.aspect.aspectfit         };           img.source = imagesource.fromstream (() => {             var writer = new barcodewriter {                 format = barcodeformat.qr_code,                  options = new encodingoptions {                     height = 200,                     width = 600                 }             };             var bitmap = writer.write ("my content");              memorystream ms = new memorystream ();             bitmap.compress (bitmap.compressformat.jpeg, 100, ms);             return ms;         });          var layout = new stacklayout {             children =              { img}         };          content = layout;  } 

as writing bitmap data memorystream using compress() method position of stream @ end when return it.

make sure reset stream's position before returning adding line.

ms.position = 0; 

the image read stream beginning, rather end.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -