Android Bitmap Decode decodeBitmapFromAssets(Context context, String fileName)

Here you can find the source of decodeBitmapFromAssets(Context context, String fileName)

Description

decode Bitmap From Assets

Declaration

public static Bitmap decodeBitmapFromAssets(Context context,
        String fileName) 

Method Source Code

//package com.java2s;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import java.io.InputStream;

public class Main {

    public static Bitmap decodeBitmapFromAssets(Context context,
            String fileName) {// ww w .ja  va 2s .  c  om
        InputStream is = null;
        try {
            is = context.getAssets().open(fileName);

            return BitmapFactory.decodeStream(is);
        } catch (Exception e) {
            return null;
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (Exception ee) {

                }
            }
        }
    }
}

Related

  1. decodeBitmap(String path, int displayWidth, int displayHeight)
  2. decodeBitmap(String path, int maxImageSize)
  3. decodeSampledBitmapFromFile(String filename, int reqWidth, int reqHeight)
  4. decodeSampledBitmap(Uri uri, int reqWidth, int reqHeight, Activity act)
  5. decodeImageFile(String strImagePath, BitmapFactory.Options options, boolean checkOrientation)
  6. decodeSampledBitmapFromByte(byte[] res, int reqWidth, int reqHeight)
  7. decodeSampledBitmapFromFile(String file, int reqWidth, int reqHeight)
  8. decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight)