Question

I am creating an android app that has up to 100 activities. I included an option menu where the user can choose the textview size.

When the user selects the desired size, the textview size changes only in that activity where the menu was selected.

My problem is I want if the user choose a textview size, all the textviews in the 100 activities will change to the selected size, not just a asingle activity

Was it helpful?

Solution

I am creating an android app that has up to 100 activities

That seems excessive.

I included an option menu where the user can choose the textview size.

Note that if you use sp units, the user can control the text size already for the device via Settings.

My problem is I want if the user choose a textview size, all the textviews in the 100 activities will change to the selected size, not just a asingle activity

Store the desired size in SharedPreferences, so you have access to it when the app restarts. Then, in onResume() of each activity, apply the size from SharedPreferences to your desired widgets. If possible, use inheritance to reduce the number of times you need to have this apply-the-text-size code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top