Getting default text size in pixels in Android

view story

http://stackoverflow.com – I need to know the size in pixels of the current default Android font. I copied the approach listed in a very similar question here. However, instead of getting the size in pixels, I always get -1. Any ideas what I'm doing wrong? Here's the code: Context context = getActivity(); TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.textAppearance, typedValue, true); int[] textSizeAttr = new int[] { android.R.attr.textSize }; TypedArray a = context.obtainStyledAttributes((AttributeSet) typedValue.string, textSizeAttr); textSize = (HowTos)