Data Retention Suggestions

I'm just starting to program on Android. I have an application that gives progoses based on mathematical methods of stock papers and warns when paper paper will rise or fall. I have a depot class that contains a list of documents that are being viewed. My question is what is the best and, hopefully, the easiest way to store data.

As I said, my depot has an ArrayList of my Stock Paper class. User can add and remove. My paper class has the following values ​​that must be saved:

protected String Bezeichnung; protected String WKN; protected String ISIN; protected String Typ; protected String Schwerpunkt; protected String Domizil; protected String KAG; protected Date Stand; protected List<History_Entry> Historie; protected Date Startdatum; protected Date Enddatum; protected int Durchschnitt1 = 200; protected int Durchschnitt2 = 38; 

The hard thing is the value of History. It contains all the historical values ​​of StockPaper. This is an ArrayList with the class History_Entry. History_Entry simply has a double value with a value and a corresponding date. Further, it has two mean values, but I can recount them at the beginning.

My idea is to create a database containing all historical values. And a database that contains the name of the paper stock and all other values ​​from the Paper class.

I hope I'm not far off, but I'm glad to learn something new.

+5
source share
2 answers

The decision depends on how big your data is and what you do with it.

This is big? Are you looking for a lot of keys? Do you perform aggregation, filtering, selection? If one of the answers is yes, you need a database approach.

If No, you can use any simple approach. I see that all your data is String or convertible to String. You can simply save the file with lines as records, and then read it and parse it using the split function. These are a few lines of code.

Another approach is serialization. All your data - String, double and ArrayList are serializable. Just serialize / deserialize to a local file. There are many examples or tutorials on how to do simple serialization.

+3
source

You have several different options for saving data on Android, such as ...

If you want to save your data in a remote database, there are many online tutorials, see the post .

0
source

All Articles