@KTibow===
finally i got an idea (in some sense it is a bad idea but…): i suppose that you want to have the same values for your int (pages) even when there is a change in the orientation of the phone. Is it true? - In this case you have 2 solutions: first one is to use set retaininstance(true) on the fragment in which is the sketch; but in order to do that you have to “find” this fragment; normally you can do that using FragmentManager and findViewById or find by tag: looking to the mainActivity from P5 i see that the fragment has a tag (“main-fragment”) and i have tried to get it this way: no chance, i dont know exacltly why (perhaps because the fragment is not a Fragment but a “PFragment”, perhaps because this tag is “private”. So there is only one solution: that is using the Manifest and adding to it the config changes tag which means that you are taking care of config changes yourself in the code. I have tried this solution and it works: my values are not destroyed when the orientation changes, hurrah! - Remains one problem= what happens if the user hits the back button??? - In this case my values are destroyed and that is the case to use sharedPreferences…