I have the following scenario. The SQLLite database has OrderHeader and OrderDetail tables. I have an Activity where I want to display this data. There are several fields ...
As I see it - it should be like this:
- Get data from my content provider (I have).
- Get ordinals for columns in the cursor.
- Get values from cursor and format / assign them
As I said - there are many fields and writing such code (especially # 1 and # 2) is very tiring and boring :)
So, I have this idea. Since my data comes as JSON for starters (from the Internet) - I can store the original JSON presentation in the database along with collapsible data and when I need to bind - all I need to query the table for this column and deserialize using GSON. Thus - # 1 and # 2 will be 3 lines instead of many. And I will work with POJO ...
Does this sound good or is there a natural good way to bind views to data from a database?
katit source
share