Android Context Get getBitmapFromAssert(Context thisContext, String name)

Here you can find the source of getBitmapFromAssert(Context thisContext, String name)

Description

get Bitmap From Assert

Declaration

public static Bitmap getBitmapFromAssert(Context thisContext,
            String name) 

Method Source Code

//package com.java2s;

import java.io.IOException;
import java.io.InputStream;

import android.content.Context;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Main {
    public static Bitmap getBitmapFromAssert(Context thisContext,
            String name) {//from  w w w. ja v  a2s . c o m
        Bitmap bm = null;
        try {
            AssetManager am = thisContext.getAssets();
            InputStream is = am.open(name);
            bm = BitmapFactory.decodeStream(is);
            is.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return bm;
    }
}

Related

  1. getVersionName(Context context)
  2. getRawInteger(Context c, int resId)
  3. getString(Context context, int id)
  4. getString(Context context, int resId, Map replacement)
  5. getStringFromXml(Context context, int resId)
  6. getBoolean(ContentValues alarm, String key)