views:

48

answers:

0

I am trying to convert dips to pixels using the following function. I’ve tried low, medium, and high density emulators and regardless of the emulator I use, the pixel value remains the same value as the dip value I pass into the function.

private int ConvertDips(float dips) {
 int pixels = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, (float) dips, getResources().getDisplayMetrics());
 return pixels;
}

What the heck am I doing wrong here?