Converts the input byte data into the relevant Bitmap image
vahid hasani |
|
۰ نظر
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
public class Main{
/**//w w w . j av a2 s. co m
* Converts the input byte data into the relevant {@link Bitmap} image.
*
* @param imageData
* byte array which backs the image.
* @return {@link Bitmap} data constructed using the given byte data.
*/
public static Bitmap getBitmapImage(final byte[] imageData) {
BitmapFactory.Options options = new BitmapFactory.Options();
// Convert byte array to bitmap
return BitmapFactory.decodeByteArray(imageData, 0,
imageData.length, options);
}
}