views:

34

answers:

1

Hello!! I am a newbie to Android and playing around with the UI and SQLLite for a while and it looks pretty good to me . We have a requirement that for the App that all the questions would be coming from the server through REST / Web service which would be displayed on the App..

say for e.g if there are 4 questions 1) Enter your Name -- Text Box 2) Did you sleep well last night -- YES / NO 3) How many hours did you sleep - Text Box 4) How did you hear about us -- Drop down

So the requirement is that the Questions would be displayed on the App after doing a SYNC with the server during the SYNC with the server the Questions would be downloaded from the SERVER through REST / Web service..if the phone is not connected then pull the questions from the Database...

These questions are simple questions and they change quite often and we have a similar app which is there for iphone which does this ....

Has any one worked on this before please advice me so that I can get it started

A: 

We did something similar for an e-Learning app. Decide on the number of type of questions and create custom types by extending the conventional views.

Eg. To get a multiple choice question: Using TextView and RadioGroup (RadioButtons) you can create a custom type. Create your own attributes or create setter/getters to initialize title, options, right answer and load the view dynamically at run time.

Sameer Segal
@Sameer Thanks for the updates , the problem here is we just cannot store any questions on the device due to which we have to get the list of questions from the webservice and then we would need to insert them in the sqllite OR after getting the list of questions from the server need to iterate and build those components dynamically it can be as small as 2 questions or as big as 60 question i.e to capture the information for the entire month
Ameya Thakur
I did not get how that is a problem. You will have to create it dynamically and if done efficiently you can push as many questions as required.Store the type of the question in the db and accordingly populate dynamic views on the fly.If you are looking for a compile time option (creating a layout.xml) its not possible.
Sameer Segal
@Sameer This is what we are thinking of doing , we would be getting the question in form of xml from the webservice and then we would store them in the sqllite db after parsing and then I would need to use layout templates and the through java create the UI by iterating depending upon the number of questions.. I was curious to know did anyone implemented this kind of approach earlier....due to certain policies we cannot store questions on the devices
Ameya Thakur
As I had mentioned we did something similar for an E-Learning app. While there was no explicit policy, we refreshed our data when the person completed the module.
Sameer Segal
@Sameer thanks for the info can you please give some more inputs about the following so that I can check it also since this app is working on your end I hope that there is no performance issueEg. To get a multiple choice question: Using TextView and RadioGroup (RadioButtons) you can create a custom type. Create your own attributes or create setter/getters to initialize title, options, right answer and load the view dynamically at run time.
Ameya Thakur