get Display Metrics - Android android.app

Android examples for android.app:Display

Description

get Display Metrics

Demo Code

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

public class Main{


    public static DisplayMetrics getDisplayMetrics(Context pContext) {

        DisplayMetrics metrics = new DisplayMetrics();
        ((Activity) pContext).getWindowManager().getDefaultDisplay()
                .getMetrics(metrics);/*from w w w .j av  a  2 s  .com*/
        return metrics;
    }

}

Related Tutorials