get resource Bitmap Size - Android Graphics

Android examples for Graphics:Bitmap Resource

Description

get resource Bitmap Size

Demo Code


//package com.java2s;
import android.content.Context;
import android.graphics.BitmapFactory;

public class Main {
    public static BitmapFactory.Options getSize(Context c, int resId) {
        android.graphics.BitmapFactory.Options o = new android.graphics.BitmapFactory.Options();
        o.inJustDecodeBounds = true;/*from w  w  w .j  ava 2 s.  co  m*/
        BitmapFactory.decodeResource(c.getResources(), resId, o);
        return o;
    }
}

Related Tutorials