List of usage examples for android.graphics Bitmap getByteCount
public final int getByteCount()
From source file:com.android.volley.cache.MemLruImageCache.java
/** * Get the size in bytes of a bitmap.//from w w w . ja v a 2 s . c o m */ @TargetApi(19) public static int getBitmapSize(Bitmap bitmap) { // From KitKat onward use getAllocationByteCount() as allocated bytes can potentially be // larger than bitmap byte count. /* if (Utils.hasKitKat()) { return bitmap.getAllocationByteCount(); }*/ if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.tsu.common.image.ImageCache.java
/** * Get the size in bytes of a bitmap in a BitmapDrawable. * @param value/*from w w w.j av a2s. c o m*/ * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(BitmapDrawable value) { Bitmap bitmap = value.getBitmap(); if (VersionUtils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:org.iisgcp.waterwalk.utils.ImageCache.java
/** * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from Android 4.4 (KitKat) * onward this returns the allocated memory size of the bitmap which can be larger than the * actual bitmap data byte count (in the case it was re-used). * * @param value// ww w. j av a 2 s . c o m * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(BitmapDrawable value) { Bitmap bitmap = value.getBitmap(); if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:org.nativescript.widgets.image.Cache.java
/** * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from Android 4.4 (KitKat) * onward this returns the allocated memory size of the bitmap which can be larger than the * actual bitmap data byte count (in the case it was re-used). * * @param bitmap/*from ww w . j a v a 2 s . c om*/ * @return size in bytes */ @TargetApi(VERSION_CODES.KITKAT) public static int getBitmapSize(Bitmap bitmap) { // From KitKat onward use getAllocationByteCount() as allocated bytes can potentially be // larger than bitmap byte count. if (Utils.hasKitKat()) { return bitmap.getAllocationByteCount(); } if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:net.wespot.pim.utils.images.ImageCache.java
/** * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from Android 4.4 (KitKat) * onward this returns the allocated memory size of the bitmap which can be larger than the * actual bitmap data byte count (in the case it was re-used). * * @param value/*from w w w .j a va2s . c o m*/ * @return size in bytes */ public static int getBitmapSize(BitmapDrawable value) { Bitmap bitmap = value.getBitmap(); if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.globant.mobile.handson.media.BitmapCache.java
/** * Get the size in bytes of a bitmap in a BitmapDrawable. * @param value/*from w w w .j a va 2 s .c o m*/ * @return size in bytes */ @TargetApi(12) public static int getBitmapSize(BitmapDrawable value) { Bitmap bitmap = value.getBitmap(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.lovebridge.chat.view.ImageCache.java
/** * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from * Android 4.4 (KitKat) onward this returns the allocated memory size of the * bitmap which can be larger than the actual bitmap data byte count (in the * case it was re-used).//from w ww . j av a 2s . c o m * * @param value * @return size in bytes */ @TargetApi(19) public static int getBitmapSize(BitmapDrawable value) { Bitmap bitmap = value.getBitmap(); // From KitKat onward use getAllocationByteCount() as allocated bytes // can potentially be // larger than bitmap byte count. // if (Utils.hasKitKat()) { // return bitmap.getAllocationByteCount(); // } if (com.lovebridge.chat.utils.Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.easemob.video.util.ImageCache.java
/** * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from * Android 4.4 (KitKat) onward this returns the allocated memory size of the * bitmap which can be larger than the actual bitmap data byte count (in the * case it was re-used)./*from w ww . j a v a 2 s . c o m*/ * * @param value * @return size in bytes */ @TargetApi(VERSION_CODES.KITKAT) public static int getBitmapSize(BitmapDrawable value) { Bitmap bitmap = value.getBitmap(); // From KitKat onward use getAllocationByteCount() as allocated bytes // can potentially be // larger than bitmap byte count. if (Utils.hasKitKat()) { return bitmap.getAllocationByteCount(); } if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.liangxun.university.huanxin.chat.video.util.VideoImageCache.java
/** * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from * Android 4.4 (KitKat) onward this returns the allocated memory size of the * bitmap which can be larger than the actual bitmap data byte count (in the * case it was re-used).//from ww w .j a va 2 s. c o m * * @param value * @return size in bytes */ @TargetApi(19) public static int getBitmapSize(BitmapDrawable value) { Bitmap bitmap = value.getBitmap(); // From KitKat onward use getAllocationByteCount() as allocated bytes // can potentially be // larger than bitmap byte count. // if (Utils.hasKitKat()) { // return bitmap.getAllocationByteCount(); // } if (HxUtils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
From source file:com.example.com.jglx.android.app.util.video.ImageCache.java
/** * Get the size in bytes of a bitmap in a BitmapDrawable. Note that from * Android 4.4 (KitKat) onward this returns the allocated memory size of the * bitmap which can be larger than the actual bitmap data byte count (in the * case it was re-used).// ww w. j av a 2 s . c om * * @param value * @return size in bytes */ @TargetApi(19) public static int getBitmapSize(BitmapDrawable value) { Bitmap bitmap = value.getBitmap(); // From KitKat onward use getAllocationByteCount() as allocated bytes // can potentially be // larger than bitmap byte count. // if (Utils.hasKitKat()) { // return bitmap.getAllocationByteCount(); // } if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }