Skip to content Skip to sidebar Skip to footer

How To Convert Bitmap To Byte Array In Mono For Android

I am using Mono for Android, I would like to save a bitmap to a byte array  So I can save it to a database. Searching in here I found the following piece of code: ByteArrayOutputS

Solution 1:

You need to use MemoryStream in MonoDroid instead. Try this:

MemoryStreamstream=newMemoryStream();
bitmap.Compress(Bitmap.CompressFormat.Png, 0, stream);
byte[] bitmapData = stream.ToArray();

Solution 2:

import this package import java.io.ByteArrayOutputStream;

Post a Comment for "How To Convert Bitmap To Byte Array In Mono For Android"