开发者

Creating a dynamic app in Android

I am currently looking to create an application in Android where a user can answer a questionnaire and that information is saved. The questionnaire will be in a sqlite database and can have different set on answers, and their can be several questionnaires the user can choose to fill. how do i go about firs开发者_如何学Gotly having the ability to create a dynamic questionnaire view for the user?


You can add your questions in code?

Get your all questions from the database, and pick your questions, or just query them with a limit and an order by rand()

Then instead of hardcoding the questions in xml, you'll add them to your views with .setText()


You can fetch questions from random rowids and present them... So, each time u execute, you will be fetching random questions from SQLite database and hence different questionnaire...


I think you can take to approaches:

1 - create a web-based view. You must read the questionnaire and generate the html, then present it in a WebView.

2 - generate a xml layout and inflate it. With "inflate" i'm referring to use the object LayoutInflater with some of inflate calls that accept an XmlPullParser, it's must generate a view exactly identical to a view defined in the IDE. I never test it so please let my know if it's works.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜