Back to project page 101AndroidApps.
The source code is released under:
Licenced under the Creative Commons Attribution 4.0 licence. For full text see http://creativecommons.org/licenses/by/4.0/
If you think the Android project 101AndroidApps 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.hulzenga.ioi.android.util; //from w w w . ja v a2 s . co m import android.content.Context; public class ScreenMetrics { public static float pixToDp(float pix, Context context) { float density = context.getResources().getDisplayMetrics().density; return pix / density; } public static float dpToPix(float dp, Context context) { float density = context.getResources().getDisplayMetrics().density; return density * dp; } }