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 firstly 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.
Related
I'm working on an application that should allow the user to tag a user onto an item. In Google Drive, for example, when you're entering users to send an item to, the user's name becomes it's own "view" in the textview so that it cannot be modified and broken.
My current implementation already contains an autocomplete registry of current users, and formats the usernames with html tags so that they're interpreted correctly by the backend, but it's still possible to tamper by moving the cursor to the center of the name and modifying it.
I would like at least an example of how to accomplish what I am trying to do. The problem itself is hard to search for, probably because I just don't know what to call it.
Example of what I'm looking for: http://imgur.com/EBDoWED
Eventually, I came accross this: https://plus.google.com/+RichHyndman/posts/TSxaARVsRjF
Seeing that they're called "chips" is making this a lot more researchable. I'm still a bit weary about what I'm going to do, but I've got enough resources to start.
I'm going to attempt to make a LinearLayout that dynamically contains "chips" and edittext views and handles most of the functions of an edit texts.
New to android development. I recently finished the lynda.com tutorials, but want to get more involved. I was thinking about doing an app that shows various quotes from movies, but am in need of some guidance. I just want it to have one activity and am going to have a next and previous buttons at the top. How would I create the app that shows quotes in a randomized order and keep the quotes on the same screen?
Thanks for any and all help!
Create an SQL Database and store your strings in the table and display it using list view.
http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/ - tutorial for database.
Your request is essentially just a basic layout question: Create a basic view, lay it out with a text field and two buttons. Create either an array list of strings or an SQLite database (as detailed by user3245033). You will then need to add listeners to both buttons (http://developer.android.com/reference/android/widget/Button.html). The next button should generate a random number that becomes an index into the list or database storing your quotes, the back button should store the previous index value (so that you can go back to the same quote as opposed to a random quote). When you're retrieved your quote, set the text field to that string.
There are many basic examples that demonstrate this type of work. mybringback on YouTube particularly amazing:
http://www.youtube.com/playlist?list=PLB03EA9545DD188C3
I need to develop a survey application.
The user will make some choices first and then the appropriate list of questions will be shown.
Since I have a list of more then 2000 questions to choose from, it is impossible to create a XML layout for each type of survey. The idea is to iterate through a local SQLite database where the questions are stored and show only those which meet the parameters set at the beginning by the user.
Is creating the layout at runtime in Java the only solution? I would like to keep the application views separated from the application logic. The questions will be of multiple types (multi-choice, radio buttons, drop-downs...)
Any suggestions?
You can create a template for each of the question types in xml and then just inflate that at runtime and fill in the correct information. This will allow you to redesign the look without having to touch code.
I have a button on my home screen that will add an edit text field every time it is pushed (I limited it to 20 for best practice). It is basically a small budgeting app. I want the user to fill in an X amount of dollars in one of the fields. Then, when they are ready, to come back to the app another time and that created EditText is still there filled with the value. I know how to utilize SharedPerfrences to hold the value. I do not, however, know how to hold that newly created EditText field when the user comes back.
I am acutally going to expand and have a button and a datepicker associated with each EditText field so soon click the button will create three objects, not just one. But I want to get one working first and will apply the principle to the others later. Any suggestions?
Sounds like a good candidate for a SQLite database.
For instance, I use a SQLite database to retain and recall the co-ordinates and types of widgets that the user has arranged within my application.
Note that you don't ever want to be trying to store and recall the actual EditText View object itself. In your database you need to devise your own table format that suits the kind of information you need to store. If you simply need to retain the states of a series of EditText fields then this could be as simple as having a table with just one column that contains a string value on each row. To build your UI up again from that database, you'd loop through and create a new instance of EditText, and set the text of each one from the table.
You would have to use Android Parcelable interface, refer to this to know as of how to implement it, refer to this question which I has asked on StackOverflow, it has a good answer.
friends,
i want to perform functionality same like stackoverflow tags as we do normally creating a question separated by commas in android.
i know we have auto complete text view in android any one suggest me can i use it for multi selection?
or any useful way to achieve this?
any help would be appreciated.
it can be achieve through two ways
i devised my own machanism so may b you people have better approach than me please share too.
1) simple
2) advance
1) in simple we can use autocomplete text view and only use single tag with hard coded values which is limitation.
2) i have used a popup page with a Edittext and add button on top and listview with checkboxes below it.
fixed items i have already loaded into list view with checkboxes so that i could select multiple tags.
and in case of if i want to add my custom tag then i use that edit text above list view and store it in temporary data and
then finally using bundle i show selected values where i want seperated by commas.
thats it.