Example usage for android.graphics Bitmap getRowBytes

List of usage examples for android.graphics Bitmap getRowBytes

Introduction

In this page you can find the example usage for android.graphics Bitmap getRowBytes.

Prototype

public final int getRowBytes() 

Source Link

Document

Return the number of bytes between rows in the bitmap's pixels.

Usage

From source file:Main.java

public static int getSize(Bitmap bitmap) {
    if (bitmap == null) {
        return 0;
    }/* ww w  .ja  v a  2 s .c  o m*/
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
        return bitmap.getByteCount();
    } else {
        return bitmap.getRowBytes() * bitmap.getHeight();
    }
}

From source file:binh.app.englishidiom.ImageCache.java

public static int getBitmapSize(Bitmap bitmap) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1)
        return bitmap.getByteCount();
    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:Main.java

@SuppressLint("NewApi")
public static int getBitmapSize(Bitmap bitmap) {
    if (bitmap == null) {
        return 0;
    }/*  w ww . j a va  2s. c  om*/
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
        return bitmap.getByteCount();
    } else {
        return bitmap.getRowBytes() * bitmap.getHeight();
    }
}

From source file:com.hellosky.recyclingimageloader.util.ImageMemoryCache.java

public static int getBitmapSize(BitmapDrawable value) {
    Bitmap bitmap = value.getBitmap();

    if (Utils.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }//  w w w. j a  v a  2s  .c o m
    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:inc.bait.jubilee.model.helper.util.ImgCache.java

@TargetApi(12)
public static int getBitmapSize(Bitmap bitmap) {
    if (ApiHelper.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }/*  ww  w .j  ava2  s  .  co m*/
    // Pre HC-MR1
    return bitmap.getRowBytes() * bitmap.getHeight();
}

From source file:Main.java

public static long getBitmapSize(Bitmap bitmap) {
    long size = 0;
    if (bitmap != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
            return bitmap.getByteCount();
        } else {// w ww  .j ava 2 s . c  o m
            // Pre HC-MR1
            return bitmap.getRowBytes() * bitmap.getHeight();
        }
    }
    return size;
}

From source file:Main.java

public static long getBitmapSize(Bitmap bitmap) {
    // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // API19
    // return bitmap.getAllocationByteCount();
    // }/*from  www .  j a v a 2  s. c om*/
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {// API12
        return bitmap.getByteCount();
    }
    return bitmap.getRowBytes() * bitmap.getHeight(); // earlier version
}

From source file:Main.java

@SuppressLint("NewApi")
public static int getBitmapSize(Bitmap bitmap) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // API 19
        return bitmap.getAllocationByteCount();
    }// www  .j  a  v  a  2 s.  co m
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {// API 12
        return bitmap.getByteCount();
    }
    return bitmap.getRowBytes() * bitmap.getHeight(); // earlier version
}

From source file:Main.java

/**
 * returns the bytesize of the give bitmap
 *///from w  w  w . j  av a2 s .c o m
public static int byteSizeOf(Bitmap bitmap) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        return bitmap.getAllocationByteCount();
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR1) {
        return bitmap.getByteCount();
    } else {
        return bitmap.getRowBytes() * bitmap.getHeight();
    }
}

From source file:com.lark.http.cache.BitmapImageCache.java

@SuppressLint("NewApi")
public static int getBitmapSize(Bitmap bitmap) {
    if (SDKVersionUtil.hasKitKat()) {
        return bitmap.getAllocationByteCount();
    }/*w w w .ja  v a2 s . com*/

    if (SDKVersionUtil.hasHoneycombMR1()) {
        return bitmap.getByteCount();
    }
    return bitmap.getRowBytes() * bitmap.getHeight();
}