Back to project page goodintentions.
The source code is released under:
Apache License
If you think the Android project goodintentions listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.luboganev.goodintentions; //from w w w.ja v a 2 s . c o m import android.content.Context; import android.util.TypedValue; public class UIUtils { /** * Returns the physical pixels that * corresponds to the input DIPs * * @param context * Use application context and not some activity's context to prevent memory leaks */ public static int getPixelsFromDips(Context context, int dips) { float result = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dips, context.getResources().getDisplayMetrics()); return (int)result; } }