What Is The Simplest Way In Android To Keep An Objects Value After Every App Run?
What is the simplest way to store a single object value so that the object is not null the next time the app is executed? for example: public class MainActivity extends Activity {
Solution 1:
You need to look at Storage Options and see which is best for your needs. You probably want to add it to sharedprefs somewhere, which uses a key/value pair, if it is lite data. Otherwise, you may want a SQLite DB. But X is always going to be "Hello" the way you have it so you will need a function somewhere to set the sharedprefs or whatever you use. I'm assuming you just put that code for simplicity but just pointing that out.
Post a Comment for "What Is The Simplest Way In Android To Keep An Objects Value After Every App Run?"