Java tutorial
//package com.java2s; import android.app.Activity; import android.util.DisplayMetrics; public class Main { public static float computeY(Activity activity, float val) { DisplayMetrics displayMetrics = new DisplayMetrics(); activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int h = displayMetrics.heightPixels; return val * ((float) h / 1200.0f); } }