Android examples for User Interface:Screen Resolution
get Dimension In Dp
//package com.java2s; import android.content.Context; import android.support.annotation.DimenRes; public class Main { public static int getDimensionInDp(Context context, @DimenRes int dimenResId) { return (int) (context.getResources().getDimension(dimenResId) / context .getResources().getDisplayMetrics().density); }//from ww w .java 2 s .c om }