I have several activations, to which when I click on the menu, a SearchBar appears and the user can move the slider to change the text size. In each of the ativiti implemented such code
private static SharedPreferences sharedPref; public static final String FONT_SIZE = "FONT_SIZE"; @Override protected void onCreate(Bundle savedInstanceState) { final SeekBar seekBar = (SeekBar) findViewById(R.id.seekBar); seekBar.setOnSeekBarChangeListener(this); loadSizeFont(); } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { sizeFont = progress; tv_text.setTextSize(sizeFont); saveSizeFont(); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } void saveSizeFont() { sharedPref = getPreferences(MODE_PRIVATE); SharedPreferences.Editor ed = sharedPref.edit(); ed.putInt(FONT_SIZE, sizeFont); ed.apply(); } void loadSizeFont() { sharedPref = getPreferences(MODE_PRIVATE); int size = (int) sharedPref.getInt(FONT_SIZE, 17); tv_text.setTextSize(size); seekBar.setProgress(size); } If in activation 1, the user has increased the font, then switched to activation 2, there you need to call seekbar again and move the slider. This is not very convenient. It is necessary that by changing the size of the size in one place, it would change in the rest of the necessary activations. Tell me how to implement it correctly?