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:
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.
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:
I want sign apk.A password is required for that.Which passoword is needed here?What If I have forgot?
ReplyDeleteIf you have signed an Apk and uploaded it on play store, you cannot update it if you forget the password of your keystore.
DeleteIf 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.
Hi Friend,
ReplyDeleteWhat 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
Use the to lowercase block in your retrieval of edit text or what ever
DeleteThis comment has been removed by the author.
ReplyDeleteWhat 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?
ReplyDeleteHow i can monetize to this app?
ReplyDeleteIs there any way I can use sqlite or .db file in sketchware?
ReplyDeleteNo, 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.
DeletePlease 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
ReplyDeleteWhich function you did not understand?
DeleteThis comment has been removed by the author.
ReplyDeletePut 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).
DeleteAnd numbering should be continuous and correct.
DeleteMy Dictionary word is not show. Why? Too Much word?
ReplyDeleteDelete that previous one before install new project
DeleteI need more info about search bar for custom listview
ReplyDeleteHello,
ReplyDeleteGreat 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!
Please tell me with scroll layout
ReplyDeleteHow could I put image together with the meanings?
ReplyDeleteHow to create file folder file getKey data,,,where insert question and meaning
ReplyDeleteWhat if i use more than two textviews? What should i do?
ReplyDeleteWhat if i use more than two textviews? What should i do?
ReplyDeleteHello 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
ReplyDeleteAwords | 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
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.
ReplyDeleteYou have to add File Shared Preferences component for that
DeletePlease help when I search words it's not bringing anyword
ReplyDeleteHi. Will you just give me your Email
ReplyDeletesanjeevk4571@gmail.com
DeleteMy Dictionary word is not show. Listview.Why?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHello I tried searching in my dictionary but it not working, the app will stop working after I input the second word.
ReplyDeleteWhat is this my bro" String literal is not properly closed by a double-quote"
ReplyDeleteWill you please provide the full code of this app?
ReplyDelete