Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.BitmapFactory;

public class Main {
    public static int[] getBitmapSizeFromPath(String filePath) {
        // First decode with inJustDecodeBounds=true to check dimensions
        final BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;

        BitmapFactory.decodeFile(filePath, options);
        int[] array = new int[2];
        array[0] = options.outWidth;
        array[1] = options.outHeight;
        return array;
    }
}