Get Bitmap's height - Android Graphics

Android examples for Graphics:Bitmap Size

Description

Get Bitmap's height

Demo Code


//package com.java2s;

import android.content.res.Resources;

import android.graphics.BitmapFactory;

public class Main {
    /** Get Bitmap's height **/
    public static int getBitmapOfHeight(Resources res, int id) {
        try {/*from  ww w . j ava 2 s  .c  om*/
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inJustDecodeBounds = true;
            BitmapFactory.decodeResource(res, id, options);
            return options.outHeight;
        } catch (Exception e) {
            return 0;
        }
    }
}

Related Tutorials