List of utility methods to do Bitmap Load
Bitmap | getBitmapFromFileInputStream(FileInputStream is) get Bitmap From File Input Stream if (is == null) return null; Bitmap bitmap = null; try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Config.RGB_565; options.inPurgeable = true; options.inInputShareable = true; ... |
Bitmap | getBitmapFromRes(Context context, int resId) get Bitmap From Res Bitmap bitmap = null; try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Config.RGB_565; options.inPurgeable = true; options.inInputShareable = true; bitmap = BitmapFactory.decodeResource(context.getResources(), resId, options); ... |
Bitmap | getFromUrl(String url) Gets the from url. URL myFileUrl = null; try { myFileUrl = new URL(url); } catch (MalformedURLException e) { e.printStackTrace(); HttpURLConnection conn = (HttpURLConnection) myFileUrl .openConnection(); ... |
Bitmap | getImageFromUri(Context ctx, Uri uri, int reqWidth, int reqHeight) get Image From Uri InputStream iStream = ctx.getContentResolver().openInputStream(uri); byte[] inputData = getBytes(iStream); return decodeSampledBitmapFromBytes(inputData, reqWidth, reqHeight); |
boolean | getNetBitmap(String strUrl, File file, Context context, File file2) get Net Bitmap Log.e(TAG, "getBitmap from net"); Bitmap bitmap = null; InputStream in = null; FileOutputStream out = null; try { URL url = new URL(strUrl); HttpURLConnection con = (HttpURLConnection) url .openConnection(); ... |
void | loadBitmap(Activity activity, int resId, ImageView imageView, int reqWidth, int reqHeight) load Bitmap BitmapFromResourcesTask task = new BitmapFromResourcesTask(
activity, imageView, reqWidth, reqHeight);
task.execute(resId);
|
Bitmap | loadBitmap(Context c, String fileName) load Bitmap ParcelFileDescriptor pfd; try { pfd = c.getContentResolver().openFileDescriptor( Uri.parse("file://" + fileName), "r"); } catch (IOException ex) { return null; java.io.FileDescriptor fd = pfd.getFileDescriptor(); ... |
Bitmap | loadBitmap(Context c, String fileName, int width) load Bitmap ParcelFileDescriptor pfd; try { pfd = c.getContentResolver().openFileDescriptor( Uri.parse("file://" + fileName), "r"); } catch (IOException ex) { return null; java.io.FileDescriptor fd = pfd.getFileDescriptor(); ... |
Bitmap | loadBitmap(Context c, String fileName, int width, boolean sample) load Bitmap ParcelFileDescriptor pfd; try { pfd = c.getContentResolver().openFileDescriptor( Uri.parse("file://" + fileName), "r"); } catch (IOException ex) { return null; java.io.FileDescriptor fd = pfd.getFileDescriptor(); ... |
Bitmap | loadBitmap(InputStream is) load Bitmap try { if (is != null && is.available() > 0) { return BitmapFactory.decodeStream(is); } else { return null; } catch (IOException e) { return null; ... |