Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.blundell.tut.util;
- import android.content.Context;
- public class AndroidUtils {
- /**
- * Converts the number in dips to the number in pixels
- */
- public static int convertToPix(Context context, int sizeInDips){
- float scale = context.getResources().getDisplayMetrics().density;
- float size = sizeInDips * scale;
- return (int) size;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement