Saving and displaying user answers from multiple choice form - blackberry

I have a list field which contains questions in the first screen and I am passing the selected index of the list to the second screen I am parsing JSON according to the question id. I am parsing the answers for the questions. The question will be 2 types such as single answer and multiple answer. I am displaying an array of Radio button field for single answers and a array of Checkbox field for multiple answers.
If the user selects the answer, I need to store it temporarily and I should show him the answer which he selected when he selects the same question. I don't have idea in this. Can any one guide me in this? I need to do it using sqlite?

you can use Persistent object in BlackBerry. Here is a code sample demonstrates the example to use the persistent-object-in-blackberry

Related

UISearchController filter using two strings [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I have been following the tutorial for creating a UISearchController using https://www.raywenderlich.com/113772/uisearchcontroller-tutorial
Everything is set up and working perfectly. I have two categories in my dataArray: Borough and Neighborhood. I set up my searchBar to only look into the values for Neighborhood. I created buttons for the different boroughs and what i'm hoping to achieve is when the button is pressed it will show all the possible values for that borough, but I can't seem to find anything to do this
I believe what you are saying is that you want to search for a text value entered via the search bar in the Neighbourhood values and to specifically look for the Neighbourhood in a given Borough. Correct?
If that is the case, all you'd have to do is modify your search condition. If your search condition is currently something like (to borrow from the rw.com tutorial):
return row.neighbourhood.lowercaseString.containsString(searchText.lowercaseString)
Then you'd have to modify the condition to include a check for the Borough name too - and here, we'll assume the borough variable contains the Borough name that you selected via button press:
return row.neighbourhood.lowercaseString.containsString(searchText.lowercaseString) && row.borough == borough
That should return only array values which have the specified Neighbourhood name and are in the given Borough. If that is not what you wanted, then you might want to provide a bit more detail such as the structure of the data array, how the Neighbourhoods and Boroughs are linked, and perhaps even a screenshot of the UI so that we can see how you select a Borough in the UI.

UITableview Grouping

I have a sorted array of strings. I want to group them using tableview section according to first letter similar to iPhone contact.
I am new to iOS can any one help me to do this, The array is retrieving from server.
and also there is a search option for table view
If I understood your question correctly, you want to group and index the items alphabetically?
There is a system class to do that, called UILocalizedIndexedCollation.
Here is a nice tutorial for it:
http://benedictcohen.co.uk/blog/archives/230
Please check this given below link
http://iamthewalr.us/blog/2009/12/uisearchdisplaycontroller-and-uilocalizedindexedcollation/

Load UITableView with List Containing Many Records [duplicate]

This question already has answers here:
Load UITableView From CSV Database File?
(2 answers)
Closed 8 years ago.
I currently have a list of 1,000 records that I would like to use to populate into a Tableview but I am not sure how to go about doing so. The list is currently in a .txt file. Does anyone have any suggestions as to how to go about populating the table view with this list. Any suggested line of codes would be greatly appreciated.
EDIT: Updating initial question to provide more detail.
Say I have a list of all of the countries in the world that I want to load into a tableview. I have the list in a text file. Is the best approach to insert all of the countries one by one into an array or can I just link the data source of the table view to the .txt file to load the data? Maybe there is another way that I cannot think of. (Sorry if this is not enough detail, I am new to Objective C)
Just read the file using NSFileManager. Once you have the file into a single string object, then you can check this answer in how to split an string obtained from a file.
How to split newline from NSString in ObjectiveC
Then once you have this into an array you can fill your tableView really easy using the UITableViewDataSource Delegate Method
cellForRowAtIndexPath:
just assign to the cell.textLabel.text the value for the array at index indexPath.row provided by the method.
cellForRowAtIndexPath:
If you can provide some code and the example in how your file looks you could receive more help. Your questions is vague but what I just answer might help to clarify your ideas

iOS / Xcode: saving datalist ipad [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
im new to iOS/xcode app and have a question.
If i make a form with "name" "age" "date now" how/where is it saving the info and how do i make new items ?
Have tried to search google for "xcode saving item to list" but its not what im looking for.
Can someone help me with a link to a tutorial or the name function that i need to look at.
So i can read/learn about
- save function
- show the saved items in a list.
- get one or more saved items to another page/view in the app.
First you need to deal with getting notified when the text in each field changes. This is done by using the delegate methods of the text fields (<UITextFieldDelegate>). In particular, textFieldDidEndEditing: will allow you to grab the text when the edit is complete.
Once you have the text, you need to store it somewhere. This could be in a dictionary, or, if you want to display in a list, it could be in an array.
A dictionary is easier if each of the text fields means something different. Then the keys of the dictionary represent the meaning.
An array is easier if it's just a list of arbitrary text. The issue here is how to know that you haven't got duplicates. In this case it can be better to have a submit button which loops over all of the text fields in order and adds the text from each to the array.
Once you have the text in an array or dictionary you can save it to disk (writeToFile:atomically:) or use that as the source data for a table view.

Storing the (array data)session in core data iOS

In my application I have seven category button on firstController which open secondController(tableView) having arrays of question. This question are in tableView which having Yes, NO buttons option for check/uncheck marks. Selecting Yes-No option will change the colour of tableView row. After answering the question the user can generate audit report(1st session). This report is usually PDF file. I am printing all the checked question on the PDF page and saving.
I have used NSUserDefault for saving all the array of checked question and NSDocumentDirectory for saving PDF file. In the current scenario, the User has to reset all the thing before he want to work for the second audit report(second session).
Now customer want the flexibility to save 1st incomplete audit report in database and would like to go for completing second audit report. Hence he can complete 1st audit report later and so on...
I have never used Core Data before, hence will the core data help me in above scenario. How can I apply logic here from scratch. Can some one give me the better idea. thanks in advance.
Edited with Explanation
I have 400 question array list taken in tableView with check/uncheck button. But for audit, user can checked question by his wish. say 100 question he checked so that he would save 100 question and print as a PDF pages.
User would like to have chance to save all incomplete session of checked-unchecked question to access it later to convert this as a PDF file.
Which method will be better?
If you just have an array or booleans or identifiers for your selected rows, don't use Core Data. Instead, just save the array to disk using writeToFile:atomically: and read it back in when required using initWithContentsOfFile:. You only want to consider Core Data if you want to store more information.
You can also have an array of dictionaries. Store the whole thing, not just the edited values (to make indexing easy). Colours are interesting. You could encode them into strings as comma separated rgb values or use an archived to convert them into data. You can't directly put the colours into a plist. You could put the colours into core data as transformable.

Resources