NewDude
NewDude

Reputation: 1

Android: How would one save data in a category or hierarchy

My question and issue is regarding being able to save my app data in some form of ordered structure or categorized form, ill explain further.

Basically im learning the ropes and making a test app that will store monthly income and expenses. I have two custom arraylists Arraylist, one for INCOME and one for EXPENSE, the user enters information via edittexts and its displayed in two separate ListViews.

Currently im saving the data using SharedPreferences. I use Gson to save my whole arraylists in sharedpreferences.

What I would like to do is save the data under different months. So the data will be stored under Jan Feb Mar etc.From what iv read and understood this might not be possible to do through SharedPreferences. Iv read futher through Sqlite and internal storage but havent been able to tell which one will be the best option for my example.

So given my situation and even generally, what is the best way to have data categorized.

Upvotes: 0

Views: 59

Answers (1)

dsharew
dsharew

Reputation: 10665

If I were you I would just create simple sqlite table like this:

enter image description here

type => Expense/Income.

Then use grouBy statements to get monthly expenses and incomes.

Upvotes: 0

Related Questions