get Bitmap Of Width - Android Graphics

Android examples for Graphics:Bitmap Size

Description

get Bitmap Of Width

Demo Code


//package com.java2s;

import android.graphics.BitmapFactory;

public class Main {
    public static int getBitmapOfWidth(String file) {
        try {/*w  w  w.j ava2s . com*/
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inJustDecodeBounds = true;
            BitmapFactory.decodeFile(file, options);

            return options.outWidth;
        } catch (Exception e) {
            // TODO: handle exception
            return 0;
        }
    }
}

Related Tutorials