user1107888
user1107888

Reputation: 1525

Dynamic array, which can also be saved to file

In my Android application, I need to make a list of favorite items. Each of these items consists of 3 key/value pairs. I want a dynamic array capable of:

Any suggestions?

Upvotes: 0

Views: 68

Answers (2)

Bush
Bush

Reputation: 2533

Use ArrayList for the first 3 dots, for the last, override the toString() method and write the result to a file.

Upvotes: 0

Matt Ball
Matt Ball

Reputation: 359936

SharedPreferences sounds perfect given your requirements.

The SharedPreferences class provides a general framework that allows you to save and retrieve persistent key-value pairs of primitive data types. You can use SharedPreferences to save any primitive data: booleans, floats, ints, longs, and strings. This data will persist across user sessions (even if your application is killed).

Upvotes: 1

Related Questions