I need the current TextSize of the TextView in sp units.
TextSize
TextView
sp
But getTextSize() returns the size in pixels
getTextSize()
pixels
See the DisplayMetrics class, it has fields for densityDpi and scaledDensity.
densityDpi
scaledDensity
Example usage:
float sp = px / getResources().getDisplayMetrics().scaledDensity;