Android Screen Size Get getMinTouchHeight(Context context)

Here you can find the source of getMinTouchHeight(Context context)

Description

get Min Touch Height

Declaration

public static int getMinTouchHeight(Context context) 

Method Source Code

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

import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;

public class Main {
    private static DisplayMetrics _display_metrics = null;
    private static float MIN_TOUCH_SIZE = 0.25f;
    public static int STANDARD_DPI = 160;

    public static int getMinTouchHeight(Context context) {
        retrieveDisplayMetrics(context);
        return (int) (MIN_TOUCH_SIZE * _display_metrics.density * STANDARD_DPI);
    }/*from  ww  w .ja  v  a  2s . co m*/

    private static void retrieveDisplayMetrics(Context context) {
        if (_display_metrics == null) {
            Display display = ((WindowManager) context
                    .getSystemService(Context.WINDOW_SERVICE))
                    .getDefaultDisplay();
            _display_metrics = new DisplayMetrics();
            display.getMetrics(_display_metrics);
        }
    }
}

Related

  1. getScreenWidth(Context context)
  2. getScreenDensity(Context context)
  3. getScreenSize(Activity ctx)
  4. getScreenSize(Context context)
  5. getScreenSize(Context ctx)
  6. getMinTouchWidth(Context context)
  7. getDisplayHeight(Context context)
  8. getDisplayMetrics(Context context)
  9. getDisplayWidth(Context context)