How to create a dictionary app in Sketchware?

An android app for a dictionary can be created in sketchware using File:shared preferences component. Follow the steps below to create a dictionary app.

1. Start a new project in Sketchware.

2. In VIEW area of project, insert a Linear (H) with Edittext, and a Linear (V) with a ListView and two Textviews.


3. In LOGIC area add a new File (shared preference) component.

4. Go to onCreate event and more blocks named Awords, Bwords, Cwords, etc.


5. Also add a string list and a number variable.



6. In Awords, sequentially add words starting with letter A to file with an integer as key; then add meaning of each word to file with the word itself as key. Similarly add words and meanings to file for defining Bwords, Cwords, etc.


7. In onCreate event, add all words to file by using more blocks. Also add all words to the list and ListView. Use blocks as shown in the image below.


Important update: It is recommended not to use the if...else.. block for adding Awords, Bwords, etc. as shown in the videos given below, because then it may not be possible to update the app.

8. Now add events Edittext onTextChanged and ListView onItemClicked.

9. In event Edittext onTextChanged, search file for words with characters entered in Edittext and display them in ListView, using blocks as in the images below.


To be able to search for words with both upper and lower case characters, replace
If (File f getData key (toString a without decimal) substring 0 to length of charSeq) contains (charSeq)
with
If toLowerCase(File f getData key (toString a without decimal) substring 0 to length of charSeq) contains toLowerCase(charSeq)

10. In event ListView onItemClicked, display the meaning of the word clicked, by using blocks as shown in the image below.

Important update: In order to hide the keyboard when an item is selected from ListView, Insert an add source directly block here and put following code in it:
android.view.inputmethod.InputMethodManager imm = (android.view.inputmethod.InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);

11. Save and run the project.

That's all. The dictionary app is ready.

Watch the video below, to understand better:

Comments

  1. I want sign apk.A password is required for that.Which passoword is needed here?What If I have forgot?

    ReplyDelete
    Replies
    1. If you have signed an Apk and uploaded it on play store, you cannot update it if you forget the password of your keystore.

      If you have forgotten password, then you can delete the keystore and create a new one. Go to sketchware_key folder in sdcard, and delete release_key.jks, then create a new key in Sketchware.

      Delete
  2. Hi Friend,

    What about Capital and small letters. The search doesn't work if one uses the Capital letters or vice versa depending upon the stored string in the list. I think few more codes are needed there.


    Thanks

    ReplyDelete
    Replies
    1. Use the to lowercase block in your retrieval of edit text or what ever

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. What about using MIT App Inventor? Could you please write and make a video about the tutorial at the same dictionary above in MIT App Inventor?

    ReplyDelete
  5. How i can monetize to this app?

    ReplyDelete
  6. Is there any way I can use sqlite or .db file in sketchware?

    ReplyDelete
    Replies
    1. No, you cannot use sqlite or .db file in Sketchware. Sorry about this, but I am not one of the developers of Sketchware. I just make some "how-to" videos about Sketchware.

      Delete
  7. Please the owner of this tutorial kindly assist me understand the arrangements of the function blocks, i am a little bit confused about it; I need more clarifications please. Many thanks for your understanding

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Put the blocks Awords, Bwords, etc. directly in onCreate without using if..else... Block as shown in image above. (NOT like the way it is shown in video).

      Delete
    2. And numbering should be continuous and correct.

      Delete
  9. My Dictionary word is not show. Why? Too Much word?

    ReplyDelete
    Replies
    1. Delete that previous one before install new project

      Delete
  10. I need more info about search bar for custom listview

    ReplyDelete
  11. Hello,
    Great work!
    Is there a way to add many words + meanings without getting the App too heavy? Could words + meanings stored in Firebase or something?
    Thak you!

    ReplyDelete
  12. Please tell me with scroll layout

    ReplyDelete
  13. How could I put image together with the meanings?

    ReplyDelete
  14. How to create file folder file getKey data,,,where insert question and meaning

    ReplyDelete
  15. What if i use more than two textviews? What should i do?

    ReplyDelete
  16. What if i use more than two textviews? What should i do?

    ReplyDelete
  17. Hello I followed your blog and video and am now designing a wonderful dictionary that will help lots of people but now that I'm near a thousand words I have come across a problem. Maybe you can help me out. Every thousand words I add I need to Alphabetize my dictionary and renumber everything. Let's say I have 200,00 words and I've recently added 1,000. That means I must remember the app from 0-201,000!!!. The only way to make this easier is if I began each block with huge numbers like this

    Awords | 0
    Bwords | 10,000
    C Words | 20,000

    Let's say I added just 4 words to my dictionary

    Apple, Banana, Boat & Cat. The ideal sequence would be

    Apple | 0
    Banana | 10,000
    Boat | 10,001
    Cat | 20,000

    Can you show us how to number items in the more blocks out of sequence so that alphabetsizing isn't a nightmare? Please and thank you

    ReplyDelete
  18. How to you get "File^ setData key___ value___" in video at 3:42 in my sketchware this block is not having. Please help how can i make it this block.

    ReplyDelete
    Replies
    1. You have to add File Shared Preferences component for that

      Delete

Post a Comment

Popular posts from this blog

A Flash Light App in Sketchware

Create Music Player app in Sketchware

Simple car racing android game in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Firebase auth in Sketchware for Login Activity