get Grid Image Height - Android android.util

Android examples for android.util:DisplayMetrics

Description

get Grid Image Height

Demo Code


import android.content.Context;
import android.util.DisplayMetrics;

public class ImageUtil {
    private static final int RATE_HEIGHT = 7;

    public static int getGridImageHeight(Context context) {
        DisplayMetrics dm = context.getResources().getDisplayMetrics();
        return dm.heightPixels / RATE_HEIGHT;
    }//from ww  w . j  a  v a  2  s  .c  o m
}

Related Tutorials