lundi 30 novembre 2015

Handling fairly large amounts of data over multiple fragments to read and write from a Sqlite DB in Android

Looking for some advice on the best way to go about this as I'm new to this.

I have an android app that is basically a huge form split over around 30 fragments. I have approximately 800 fields split over these fragments that I need to output to a database.

I need to store these forms on the device so they can open up previous ones and these will of course then populate from the database and when saved will update the db. I've decided to go down the Sqlite route rather than the content provider.

I have two activities, my main which is a list of forms on the device and the second is the edit form activity which uses a ViewPager to navigate the fragments.

So my question is, how am I best going about getting the data to save/update from the fragments? I know I need to use an interface and I was thinking that each fragment will need an interface to pass the values from the editText fields (using getText and findViewbyID) through to the edit form activity which will have the method for the the save button which will then pass through all the variables to the Update query sitting on the dbHelper class.

Does this seem the right way to do things or does anyone have a better suggestion? Seems like this will be quite messy.

Thanks,

Aucun commentaire:

Enregistrer un commentaire