List of utility methods to do Bitmap Load
void | loadBitmap(String bitmapUrl, ImageView imageView, int reqWidth, int reqHeight) load Bitmap if (imageView != null && bitmapUrl != null) { Bitmap bitmap = getBitmapFromMemCache(bitmapUrl.toString()); if (bitmap != null) { imageView.setImageBitmap(bitmap); return; BitmapFromUrlTask task = new BitmapFromUrlTask(imageView, reqWidth, reqHeight); ... |
Bitmap | loadBitmap(String url) Load bitmap. Bitmap bitmap = null; InputStream in = null; BufferedOutputStream out = null; try { in = new BufferedInputStream(new URL(url).openStream(), IO_BUFFER_SIZE); final ByteArrayOutputStream dataStream = new ByteArrayOutputStream(); out = new BufferedOutputStream(dataStream, IO_BUFFER_SIZE); ... |
Bitmap | loadBitmap(String url) Loads a bitmap from the specified url. Bitmap bitmap = null; InputStream in = null; BufferedOutputStream out = null; try { in = new BufferedInputStream(new URL(url).openStream(), IO_BUFFER_SIZE); final ByteArrayOutputStream dataStream = new ByteArrayOutputStream(); out = new BufferedOutputStream(dataStream, IO_BUFFER_SIZE); ... |
Bitmap | loadBitmap(String url) Loads a bitmap from the specified url. Bitmap bitmap = null; InputStream in = null; BufferedOutputStream out = null; try { in = new BufferedInputStream(new URL(url).openStream(), IO_BUFFER_SIZE); final ByteArrayOutputStream dataStream = new ByteArrayOutputStream(); out = new BufferedOutputStream(dataStream, IO_BUFFER_SIZE); ... |
Bitmap | loadBitmapAsset(Context context, String asset) load Bitmap Asset InputStream is = null; Bitmap bitmap = null; try { is = context.getAssets().open(asset); if (is != null) { bitmap = BitmapFactory.decodeStream(is); } catch (IOException e) { ... |
Bitmap | loadBitmapFromAssets(Context context, String name) load Bitmap From Assets try { InputStream is = context.getAssets().open(name); Bitmap bitmap = BitmapFactory.decodeStream(is); return bitmap; } catch (IOException e) { e.printStackTrace(); return null; ... |
Bitmap | loadBitmapFromStorage(String path) load Bitmap From Storage try { FileInputStream is = new FileInputStream(path); Bitmap bitmap = BitmapFactory.decodeStream(is); return bitmap; } catch (FileNotFoundException e) { e.printStackTrace(); return null; ... |
Bitmap | loadImage(String filename) Load an image File root = Environment.getExternalStorageDirectory(); try { File directory = new File(root.getPath() + ROOT_DIRECTORY); String filepath = directory.getPath() + "/" + filename; Options option = new Options(); if (ApiLevels.getApiLevel() >= 4) { option = ApiLevel4.setInScaled(option, false); return BitmapFactory.decodeFile(filepath, option); } catch (Exception e) { Log.e("ARTags:BitmapUtil:saveImage", "Exception while loading the tag", e); return null; |
Bitmap | loadImage(String urlStr) load Image Bitmap bm = null; HttpClient httpclient = new DefaultHttpClient(); HttpParams params = httpclient.getParams(); HttpConnectionParams.setConnectionTimeout(params, 1000 * 5); HttpConnectionParams.setSoTimeout(params, 1000 * 5); HttpGet httpGet = new HttpGet(urlStr); try { HttpResponse httpResponse = httpclient.execute(httpGet); ... |
Bitmap | loadPreviewBitmap(String fileName, int width, int height) 200px PreviewBitmap try { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = false; options.inSampleSize = 1; File file = new File(fileName); if (!file.exists()) { return null; if (file.length() > 4 * 1024 * 1024) { options.inSampleSize = 4; } else if (file.length() > 1024 * 1024) { options.inSampleSize = 2; Bitmap bm = BitmapFactory.decodeFile(fileName, options); if (bm != null) { Bitmap resizebm = resizePreviewBitmap(bm, width, height); bm.recycle(); return resizebm; return null; } catch (OutOfMemoryError e) { return null; |