I have been at a standstill with this for a while. I am working on an android application that stores peopleโs tricks, favorite fishing spots, inventory and other data. All my classes are Serializable and can be saved and loaded between actions that seem to work so far. But I predict that more and more data is saved, the application will start to work slowly.
Basically I ask if there is a way to save this data throughout the application, so I donโt need to download it every time a new screen appears. I already found the following information to help, but it should be clearer to me:
Another forum said that you can write it in the Application object:
[Application] public class MyApp : Android.App.Application { public MyApp(IntPtr handle) : base (handle) { } public FishingData Data {get; set;} }
Then, as part of your work:
((MyApp) this.ApplicationContext).Data = value;
Therefore, I have never heard of this before, and I'm not sure that this will go through the whole process of the application (I feel that somehow I will have to load data through serialization. Here is what I want todo application:
The first action is the main menu, and when loading the screen, you must do the following:
- If the settings file is found, use serialization to load the previous FishingData object (I know how to do this)
- If not, create a new clean FishingData object to save later (I know that too)
- So, now that we have the FishingData object, how can I guarantee that I do not need to repeat steps 1-2 in each action. How can I somehow pass the FishingData object for the next action and make sure that it lives globally while the application is still living. I want to download it only once (via serialization) (<- I donโt know how to do this) and save it only when the user adds data to this object (which I know how to do).
Any help would be appreciated. It pushes me, I can not understand it. This seemed to be commonplace, but I could not find detailed information.
Teamchillshot
source share