get Display Metrics : DisplayMetrics « Core Class « Android






get Display Metrics

    
//package com.anoshenko.android.mahjongg;

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

class Utils {
  static public DisplayMetrics getDisplayMetrics(Context context) {
    DisplayMetrics metrics = new DisplayMetrics();
    WindowManager wm = (WindowManager) context
        .getSystemService(Context.WINDOW_SERVICE);
    wm.getDefaultDisplay().getMetrics(metrics);

    return metrics;
  }
}

   
    
    
    
  








Related examples in the same category