List of utility methods to do Bitmap Load
Bitmap | GetBitmap(String imageUrl) Get Bitmap Bitmap mBitmap = null; try { URL url = new URL(imageUrl); URLConnection conn = url.openConnection(); InputStream is = conn.getInputStream(); mBitmap = BitmapFactory.decodeStream(is); } catch (MalformedURLException e) { e.printStackTrace(); ... |
Bitmap | base642Bitmap(String string) base Bitmap Bitmap bitmap = null; try { byte[] bitmapArray; bitmapArray = Base64.decode(string, Base64.DEFAULT); bitmap = BitmapFactory.decodeByteArray(bitmapArray, 0, bitmapArray.length); } catch (Exception e) { e.printStackTrace(); ... |
Bitmap | decodeBitmap(Resources res, int resId) decode Bitmap return BitmapFactory.decodeResource(res, resId);
|
Bitmap | decodeBitmap(Resources res, int resId, int reqWidth, int reqHeight) decode Bitmap final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(res, resId, options); options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); options.inJustDecodeBounds = false; return BitmapFactory.decodeResource(res, resId, options); |
Bitmap | decodeFromFile(String path) decode From File return decodeFromFile(path, 0, 0);
|
Bitmap | decodeFromFile(String path, int reqWidth, int reqHeight) decode From File final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(path, options); options.inSampleSize = inSampleSize(options, reqWidth, reqHeight); options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(path, options); |
Bitmap | decodeSampledBitmapFileForSize(File f, int reqWidth, int reqHeight) decode Sampled Bitmap File For Size final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(f.getPath(), options); options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(f.getPath(), options); |
Bitmap | decodeSampledBitmapFromBytes(byte[] res, int reqWidth, int reqHeight) decode Sampled Bitmap From Bytes if (reqWidth > MAX_WIDTH) reqWidth = MAX_WIDTH; if (reqHeight > MAX_HEIGHT) reqHeight = MAX_HEIGHT; final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; options.inPurgeable = true; options.inInputShareable = true; ... |
Bitmap | decodeSampledBitmapFromBytesForCurrentScreen( byte[] res, Context ctxt) decode Sampled Bitmap From Bytes For Current Screen Display display = DisplayUtils.getScreenDisplay(ctxt); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; return decodeSampledBitmapFromBytes(res, width, height); |
Bitmap | decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) decode Sampled Bitmap From Resource final BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeResource(res, resId, options); options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); options.inJustDecodeBounds = false; return BitmapFactory.decodeResource(res, resId, options); |