Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.graphics.Bitmap;

import android.os.Build;

import static android.os.Build.VERSION_CODES.KITKAT;

public class Main {

    public static int getBitmapSize(Bitmap bitmap) {

        // From KitKat onward use getAllocationByteCount() as allocated bytes can potentially be
        // larger than bitmap byte count.
        if (Build.VERSION.SDK_INT >= KITKAT) {
            return bitmap.getAllocationByteCount();
        }
        // pre kitkat
        return bitmap.getByteCount();
    }
}