get Scaled Pixels - Android Graphics

Android examples for Graphics:Pixel

Description

get Scaled Pixels

Demo Code


//package com.java2s;

import android.content.Context;

public class Main {
    @SuppressWarnings("unused")
    public static int getScaledPixels(Context ctx, int unscaled) {
        return (int) (unscaled
                * ctx.getResources().getDisplayMetrics().density + 0.5f);
    }/*from w w w . ja v  a2 s .  co m*/
}

Related Tutorials