If I assign an integer value to change a certain text size of a TextView using java code, the value is interpreted as pixel (px).
TextView
px
Now does
Cleaner and more reusable approach is
define text size in dimens.xml file inside res/values/ directory:
dimens.xml
res/values/
14sp
and then apply it to the TextView:
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getResources().getDimension(R.dimen.text_medium));