get Scaled Density - Android Animation

Android examples for Animation:Scale Animation

Description

get Scaled Density

Demo Code


//package com.java2s;

import android.content.Context;

import android.util.DisplayMetrics;

public class Main {
    private static DisplayMetrics metrics;

    public static float getScaledDensity(Context context) {
        if (metrics == null) {
            getDisplayMetrics(context);//from  w  w w .ja  va 2 s . co m
        }
        return metrics.scaledDensity;
    }

    public static DisplayMetrics getDisplayMetrics(Context context) {
        if (metrics == null) {
            metrics = context.getResources().getDisplayMetrics();
        }

        return metrics;
    }
}

Related Tutorials