gurehbgui
gurehbgui

Reputation: 14694

Easiest way to store a list a my own class in a android app?

What is the best/easiest way to store a list (LinkedList) of a class which I created in an Android application?

In apps in other plattform it could be done using:

But my question is: Which of those 3 is the easiest to implement it in an Android application without using a lot of time to make this code?

Upvotes: 1

Views: 61

Answers (2)

Dmitry Ryadnenko
Dmitry Ryadnenko

Reputation: 22512

It depends on how you inted to use this data. Simplest way is inherit you class from Serializable and dump LinkedList to a file. This works great if you don't need random access to elements of this list.

SQLite is good and flexible but it requires much more coding effort.

Upvotes: 2

Pablo Santa Cruz
Pablo Santa Cruz

Reputation: 181460

Using directly SQLite in my opinion is the easiest and most straightforward way to do it. I would consider an ORM-Framework only if I have a lot of classes to store. But I am assuming that's not your case.

Straight serialization to a file might be a good idea, but I would prefer SQLite to have the possibility of using database versions, adding indexes and performing more complex search on the data easily.

Upvotes: 3

Related Questions