Method getTextSize() returns text size in pixels, but setTextSize() treats the size in sp units. That's why your text looks bigger. You should scale the size before using in setTextSize()
. You can do like this:
SharedPreferences.Editor editor = settings.edit();
editor.putFloat(TEXT_SIZE, text.getTextSize()/getResources().getDisplayMetrics().scaledDensity); // put text size in sp
editor.commit();