The main has a button that calls the second activity and a button that send an email (it runs ok).
The second activity has 3 edittexts and 2 buttons (save and restore).
I write to the 3 edittext and then save the edittexts to the map. The button restore retrieves the 3 pairs of key/values to the editexts (it runs ok)
I have too a button to close activity and return to main.
Problems:
1) After returning to the main, if I call the second activity again the values at the map are lost.
2) How can I use these pairs of values at the main activity ?
This is because you are not loading the file. Remember, when you are saving persistent data to disk, you will need to load the file when the app first starts. Otherwise how does your app know the file exists? See the attached modified code.
If I did understand, when using 2 or more activities, I need only read the file from memory at the start of my app, and at the other activities just initialize the map, ok ?
The error was that after making any changes at the map, when returning to the first activity I were not reading the file again, just trying to read the values.
I thought that the map1.get function would read it in the file,but it reads 'the file that is at the memory'.