Skip to content Skip to sidebar Skip to footer

Saving Data On Tabs

I have 3 tabs, each a separate activity. I want to save data when user clicks save on either of the tabs. There are couple of options available; shared preference, global variables

Solution 1:

That is entirely dependent upon the length of time you wish to store them for.

Storing in the Application Context will not persist data after the application has ended. It just stores in memory.

Shared preferences is a possibility for your string data but image data would require some manipulation and may have other restrictions for example size of data (TBC).

Please consult the relevant SDK documentation on Data Storage

The most convenient way would be to save the text in shared preferences and the image to disk. Refer to the getDir() function if you want to store in the application directory

Post a Comment for "Saving Data On Tabs"