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.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Point;

public class Main {

    public static Point getImageMaxDimension(Context context, int[] imgRes) {
        final Point point = new Point();

        for (int i = 0, length = imgRes.length; i < length; i++) {
            Bitmap tmp = BitmapFactory.decodeResource(context.getResources(), imgRes[i]);
            int width = tmp.getWidth();
            int height = tmp.getHeight();
            tmp.recycle();
            tmp = null;

            if (point.x < width) {
                point.x = width;
            }

            if (point.y < height) {
                point.y = height;
            }
        }

        return point;
    }
}