remember.jpg


Remembering:

None of the apps are able to remember new information given them once the app is closed. Data is stored in short term memory, rather than in permanent memory. Phones have to have long term memory, or they could never remember phone numbers, right?

remember.PNG


Goal: In this app, we will teach the device how to remember. This video gives an overview. Be sure you take the time to watch the video, otherwise you are blindly following instructions. You need the overview for the instructions to make sense.



Phase 1



1. Add two textboxes. I called mine Answer1 and Answer2.

A) One to enter a name

B) One to answer a question.

***In this example, we use a person's name and the answer to the question "What does the fox say?"


2. Add two buttons.

A) One to enter new data. When clicked, it will read the contents of the textboxes and add the concatenated (joined) information to a list.

B) One to clear the contents of the list.

***We'll program these in step 4. Our buttons are called Enter and ClearAll


3. Drag in a **ListPicker (under user interface). I changed the text on the list Picker to read "Tell Me All You Know".


4. Check your App. Your Design should look something like this

RememberDesign.PNG

4. Program each of your buttons.

A) The list picker is easy to program. If your list is called "MyKnowledge", every time you add to the list,
you need to change the listPicker elements (the things the list Picker knows about). This is simple to do:
RememberData.PNG



6. That's it! Now, ListPicker should display the contents of the list whenever you press on the list picker.


7. To return to the main screen, just pick any element by touching it.


8. Test your app!



Phase 2



1. In order for the device to remember our "knowledge" when the app is exited, we need to tap into the long term storage on the device. The long term memory is called a "tinyDB".

A) It works like storing something in one of your drawers.
B) To store something, you must have something to store AND know what drawer you want to store it in.
C) To fetch something from your drawers, you have to know what drawer it is in and then grab it.

However, if you ask for a drawer that doesn't exist, you need to tell the device what to do.


2. With the computer, the "drawers" can be called anything you like. Suppose we want to call our drawer "ThingsIRemember". Then the code would look like:


A) Storing something:
TinyDBstore.PNG

b. Fetching something
*Notice this TinyDB block is .GetValue

tinyDBFetch.PNG

3. Try putting all the pieces together. If you need to see it, follow this **link. However, if you look at the completed code, read it, close the link, and then try to program it without looking. Do not simply copy the blocks you see. Nothing is learned from copying.