How can I use the Open button to open existing files I saved before?

Hello guys, I want to apply codes that will allow me to view my documents and select already saved notes.

This is my aia file.
Notes.aia (12.3 KB)

Thanks for your Help

Hello Olaniyi, welcome to the forum!

First of all, will the files only be created/saved/opened by your App? If so, you should save them to the default ASD folder (App Specific Folder). You can easily access them from there.

Record the filenames of the saved files in TinyDb. On launch of the App (when Screen1 Initialize) you can recover the filenames and add them to a ListPicker for the User to select from when required.

Thank you ChrisWard for your response.

Yes. The files will only be created/saved/opened by the Note App.
However, I don't know how to achieve all these you have recommended.

Using TInyDb and List Picker.

I have attached the aia file to my question, can you be of help to work on it and resend it? or show me how with the codes i need to use.

Thanks once again.

Well, I think you should try first - read the documentation on TinyDb and ListPicker, and write new code per my suggestion. If you hit an issue, you can post your new code here for help.

Right-mouse in the Blocks work area and select "Download Blocks as image"

Thank you for you help thus far. I will do exactly as you have suggested.

Cheers


I have been able to use the TinyDB and List picker. But I have a challenge.

I have two text boxes: a) The Title of the note and b) the content of the note

  1. How do I save both in TinyDB?

  2. How do I Open it with Listpicker so that each text box will display its respective content?

What I have now is that I can only save the content of the note but not with its title.

Kindly help out

  1. How do I save both in TinyDB?
    I would save them as a single string (under one tag) with a delimiter that would be unlikely to appear in a note:

Title|Note (use the Text Join block)

When restoring, use the Text Split At Block, into a temporary List, then add element 1 (index 1) of that List into a List of Titles. If the notes are not massively long, you could also have a sister List of Notes - but it is just as easy to search TinyDb and load a Note on demand.

How do I Open it with Listpicker

When restoring, add all the titles to a Block List (List of Titles), then populate the ListPicker elements with that list.

When the User selects a Title, run a loop through the TinyDb tags until the title is found (text contains). When found, split the record, populate the Text Boxes.

Phew! :grin:

I find it difficult to understand what you are asking me to do.
I have add the delimiter in saving but can't move past that.

I am still a novice using MIT APP Inventor so I have a challenge carrying out these suggestions.

Can you post your latest Project file?

Notes (1).aia (24.2 KB)
This is my latest project file.

Thanks

1 Like

You have made a very good effort Edu. A few things:

  1. Do not remove the name of the component type when naming a component e.g. 'Save' should be 'Button_Save' this makes the code much easier to understand.

  2. Give the User a 'Button_ExitApp' rather than relying only on the BackPressed.

  3. Keep your code in a single column (right mouse click clean up blocks) . It's easier to navigate.

  4. I have updated your code and added some comments to explain what happens. However, your current 'Delete Note' procedure needs to delete the TinyDb record, I have left that for you to work out - it will be similar to the Find Record loop I have added.

Notes2.aia (26.5 KB)

Lots of free advice, information and tips on my site:
https://www.professorcad.co.uk/appinventortips

2 Likes

WOW!

I can't thank you enough.

I will study the codes and learn from them.
I will also put your tips into practice henceforth.

A big thank you.

...another tip - image buttons are better than text buttons as they are understood across different languages. They can also take less space.

Hello Chris Ward,

I have a challenge with my Note App.

I discovered that whenever you saved more than one Note and then


try to delete just one out of many notes saved, all the notes get deleted.

Can you help me check the delete script if there is anything wrong there?
Notes2.aia (26.5 KB)

I have alsoo attached the aia file for the Note.

Thank You

I remembered you gave me as a to - do task, but I still couldn't figure it out.

Kindly Help out or better give me more instructions on how to solve it.

Thank You for always

Hello ChrisWard,

I used this tutorial from

to somehow found a solution to the delete button and even added a notifier to check if truly the user want to delete the note.

Is your problem now solved ?

Yes. Thank you!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.