/**
* Bitmap 工具包
* @author Thunder
* @version
* @2012-8-24
*/
public class BitmapUtil {
private static BitmapFactory.Options mOptions = null;
static {
mOptions = new BitmapFactory.Options();
mOptions.inJustDecodeBounds = false;
// options.inSampleSize = 10; //width,hight设为原来的十分一
mOptions.inPreferredConfig = Bitmap.Config.RGB_565; // 这里也可以是ARGB_8888
mOptions.inPurgeable = true;
mOptions.inInputShareable = true;
}
/**
* 获取Bitmap
* @param assetManager
* @param src
* @return
*/
public static Bitmap getBitmap(AssetManager assetManager, String src) {
Bitmap temp = null;
try {
temp = BitmapFactory.decodeStream(assetManager.open(src), null, mOptions);
} catch (IOException e) {
e.printStackTrace();
return temp;
}
return temp;
}