Code example for BitmapFactory.Options

Methods: decodeByteArray

0
     * @return The initialized BitmapDrawable. 
     */ 
    public static BitmapDrawable byteArrayToDrawable(byte[] image, Options opts, Context context) {
        if (opts == null) {
            Log.v(TAG, "opts is null, initializing without scaling");
            opts = new Options();
            opts.inScaled = false;
        } 
        Bitmap bmp = BitmapFactory.decodeByteArray(image, 0, image.length, opts);
        // bmp.setDensity(DisplayMetrics.DENSITY_HIGH); 
        return new BitmapDrawable(context.getResources(), bmp);
    } 
 
    /** 
     * Converts a byte array into a Bitmap, using the provided options. 
     * 
     * @param image The byte array representing the image. 
     * @param opts  The decoding options to use, or null if you'd like to use predefined 
     *              options (scaling will be not active). 
     * 
     * @return The initialized BitmapDrawable.