I have to develop an application for an Android Tablet. This will do the following:
I will connect to a web service to retrieve a dynamic list of forms. Those forms must be downloaded to fill them offline. When one or more forms are filled, and application is online, user can send them to a server clicked on a button.
Those forms will be dynamic. There isn't a predefined form. And they will have one or more pictures attached.
My problem is that I don't know how to do it.
I've thought:
I could send a form as set of fields and their types. Once I download xml from web service, I will have to rebuild it to show it to user.
Send an html page with a form.
HTML5 (with PhoneGap).
...?
I think second option is the best. What do you think?
Once user has filled a form, how can I save its data? If I'm using a web page, I think I can save it as CSV.
First option will be an android native interface, so I could save it on SQLite or as txt file. How can I store those forms filled?
And then, when user comes back online, how can I send a txt file and image through a web service?
If you have another approach, you are welcome to share it.
I would go for option 1 since it has a more native feel...
Fast brainstorm: You could create a DB with table: Forms (id, name ...), FormItems (id, formid, name, type, order ...), Data (id, FormItemsid, EntryId, value ...), Entries (id, dateadded, sent ...)
When you want to show a form you open an activity and you loop through all FormItems with that formid (you can have a LinearLayout (orientation: vertical) and addView for every item)
When you fill in a form a new Entry is created and you loop through your formitems and put the entred text in Data
When you go online you check what entries aren't sent yet and you send those items
Hope this was helpful!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With