Android Byte Array to Bitmap Convert ByteStringToBitmap(ByteString bytes)

Here you can find the source of ByteStringToBitmap(ByteString bytes)

Description

Byte String To Bitmap

License

Open Source License

Declaration

public static Bitmap ByteStringToBitmap(ByteString bytes)
            throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.google.protobuf.ByteString;
import java.io.ByteArrayInputStream;
import java.io.IOException;

public class Main {
    public static Bitmap ByteStringToBitmap(ByteString bytes)
            throws IOException {
        Bitmap bitmap;/*  w  ww  .ja  v  a  2 s  .  c om*/

        ByteArrayInputStream inputStream = new ByteArrayInputStream(
                bytes.toByteArray());

        bitmap = BitmapFactory.decodeStream(inputStream).copy(
                Bitmap.Config.ARGB_8888, true);
        inputStream.close();
        return bitmap;
    }
}

Related

  1. byteToBitmap(byte[] iconByte)
  2. decodeSampledBitmapFromData(byte[] data)
  3. bytes2Bimap(byte[] b)
  4. bytes2Bimap(byte[] bytes)