android - Unable to convert image bitmap to byteArray -


i using following code encode image bitmap byte[] , string @ time of encoding byte[] says unable encode..

bitmap bm = bitmapfactory.decodefile(path);         bytearrayoutputstream stream = new bytearrayoutputstream();         (bm).compress(bitmap.compressformat.jpeg, 100, stream);         bm.recycle();         byte[] byteformat = stream.tobytearray();         string encodedimage = base64.encodetostring(byteformat, base64.no_wrap); 

the app working fine, stuck here. suggest issues.

public static byte[] bitmaptobytearray(bitmap bitmap){     bytearrayoutputstream stream = new bytearrayoutputstream();     bitmap.compress(bitmap.compressformat.png, 100, stream);     byte[] bytearray = stream.tobytearray();     bitmap.recycle();     return  bytearray; } 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -