{"id":6636,"date":"2025-09-14T16:32:09","date_gmt":"2025-09-14T16:32:09","guid":{"rendered":"https:\/\/obsidiansofteducation.com\/?page_id=6636"},"modified":"2025-09-14T16:32:20","modified_gmt":"2025-09-14T16:32:20","slug":"mit-app-inventor-contacts-app","status":"publish","type":"page","link":"https:\/\/obsidiansofteducation.com\/index.php\/mit-app-inventor-contacts-app\/","title":{"rendered":"MIT App Inventor Tutorial: Create a Favourite Contacts App | Add, Call &amp; Delete Contacts Easily"},"content":{"rendered":"\n<p class=\"has-medium-font-size\">Hello friends,<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Today&#8217;s tutorial is inspired by a valued follower\u2019s request. We will be creating a Favourite Contacts app in MIT App Inventor, where you can save your most important contact numbers and call them with just one click. Let\u2019s get started!<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Open up MIT App Inventor.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Start a new project and call it ContactsApp.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">In screen 1 properties, make the background color orange and align horizontal center.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Now, drag and drop a <strong>PhoneNumberPicker<\/strong> component from the <strong>Social <\/strong>palette onto the viewer. There is a similar component called <strong>ContactPicker<\/strong>. However, a <strong>PhoneNumberPicker<\/strong> shows all contacts with phone numbers, whereas a <strong>ContactPicker<\/strong> shows even such contacts that might not have a phone number associated with them. So, for this app, it is more efficient to use a <strong>PhoneNumberPicker<\/strong>. In its properties, make the background color white, font bold, font size 18, shape rounded, and change the text to \u201cAdd Contact\u201d.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Add a <strong>ListView <\/strong>component from the <strong>User Interface<\/strong> palette below it.&nbsp;<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Now, add a <strong>horizontal arrangement<\/strong> below this listview from the <strong>layout <\/strong>palette. Make align horizontal and align vertical center alignment for it. Add a button from the user interface inside this arrangement. Rename it to callBtn. Make the background color white, font bold, font size 18, shape rounded, and change the text to \u201cCall\u201d. Select this button and duplicate it by pressing <strong>Ctrl + C and Ctrl + V<\/strong> on the keyboard for Windows OS OR <strong>Command + C and Command + V<\/strong> on the keyboard for MacOS. Rename this button to deleteBtn. Change the text to \u201cDelete\u201d.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Now, add a <strong>PhoneCall <\/strong>component from the <strong>Social <\/strong>palette for making the phone call.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Add a <strong>TinyDB <\/strong>component from the <strong>Storage <\/strong>palette for storing the contacts on the device.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Also, add a <strong>Notifier <\/strong>component from the <strong>User Interface<\/strong> palette for error messaging.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Our UX design is done, so let&#8217;s go to the blocks section.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Make a global list variable for storing the favorite contacts.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"732\" height=\"54\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-25.png\" alt=\"\" class=\"wp-image-6637\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-25.png 732w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-25-300x22.png 300w\" sizes=\"auto, (max-width: 732px) 100vw, 732px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">When the user clicks on the phone number picker component and chooses a phone number, the component\u2019s after-picking event is triggered, so get that block by choosing phone number picker on the left-hand side. The phone number picker\u2019s contact name property is filled with the picked phone number\u2019s contact name, and the phone number property is filled with the picked phone number. Do a join of these two properties with a \u201c<strong> &#8211; <\/strong>\u201c between\u2026it is a <strong>space dash space<\/strong>, and add this item to the global contacts list variable.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">Store this list in TinyDB and then provide it as elements to the listview.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"410\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-27-1024x410.png\" alt=\"\" class=\"wp-image-6639\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-27-1024x410.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-27-300x120.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-27-768x307.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-27.png 1244w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">When the screen is initialized, i.e., the app is started, we need to load already stored favorite contacts from tinyDB and show them in the listview. So, load the global contacts list from the tinyDB. Make sure to use the same tag that you used for storing the contacts in the TinyDB. Provide this list to the listview elements.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"247\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-26-1024x247.png\" alt=\"\" class=\"wp-image-6638\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-26-1024x247.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-26-300x72.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-26-768x185.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-26.png 1196w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Now, we come to the calling logic. Get the call button click event. First, do some error handling, i.e., check that the user has chosen a contact by tapping on it before clicking the call button. So, add an if\/else block to check that the listview\u2019s selection index isn\u2019t equal to 0. Now, we need to extract the phone number from the selected index of the list. So, split the selected list item at \u201c &#8211; \u201c. We will be returned a list of two items, and we know that the second item is the phone number, so get that using index=2 and set it to the phone call component\u2019s phone number property. Now, we have two ways of using the phone call component to make a phone call: <strong>MakePhoneCall <\/strong>or <strong>MakePhoneCallDirect<\/strong>. <strong>MakePhoneCall <\/strong>doesn\u2019t require any special permissions, so it can run in the companion app. <strong>MakePhoneCallDirect<\/strong> will not work in the companion app and you will need to install the app on your device and then give permission to the app when a permission dialog pops up; it will dial the number for you. On the other hand, <strong>MakePhoneCall <\/strong>will open up the keypad with the number loaded in it, but you will have to click the dial button yourself. So, decide what you want to do. I will go with <strong>MakePhoneCallDirect, <\/strong>but let me repeat that this will give an error on the companion app. You need to install it on your phone, give it permission when it asks, and then it will work.<\/p>\n\n\n\n<p class=\"has-medium-font-size\">In the else condition, show an alert message using the notifier.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"280\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-29-1024x280.png\" alt=\"\" class=\"wp-image-6641\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-29-1024x280.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-29-300x82.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-29-768x210.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-29-1536x420.png 1536w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-29.png 1600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Last is the delete button click event. Check for selection again. If selected, then remove the selected item from the contacts list, store the updated list in TinyDB, and also remove the selected item from the listview. Otherwise, show an alert message about selecting a contact before pressing the Delete button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"509\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-28-1024x509.png\" alt=\"\" class=\"wp-image-6640\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-28-1024x509.png 1024w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-28-300x149.png 300w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-28-768x382.png 768w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2025\/09\/image-28.png 1352w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">And this is done. I hope you liked this tutorial. You can have a look at the video tutorial here:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe loading=\"lazy\" title=\"MIT App Inventor Tutorial: Create a Favourite Contacts App | Add, Call &amp; Delete Contacts Easily\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/wjctrSPGvk0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<p class=\"has-medium-font-size\">Please like my videos and share it with your friends and family. Also, subscribe to my channel and press the bell icon so you don\u2019t miss any of the great projects I have planned for you.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><a href=\"https:\/\/www.youtube.com\/c\/obsidiansofteducation\" target=\"_blank\" rel=\"noopener\">https:\/\/www.youtube.com\/c\/obsidiansofteducation<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\">Please like my Facebook page and Instagram page for more educational resources and tips.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Facebook:<\/strong><a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.facebook.com\/ObsidianSoft\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Instagram:<\/strong><a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.instagram.com\/obsidiansoftapps\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>Pinterest:<\/strong>&nbsp;<a href=\"https:\/\/www.pinterest.com\/obsidiansoft\/\" target=\"_blank\" rel=\"noopener\">https:\/\/www.pinterest.com\/obsidiansoft\/<\/a><\/p>\n\n\n\n<p class=\"has-medium-font-size\">For links to free educational&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/flappy-bird-game-mit-app-inventor\/#\">&nbsp;apps<\/a>, have a look at the&nbsp;<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/mobile-apps\/\">educational apps page<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends, Today&#8217;s tutorial is inspired by a valued follower\u2019s request. We will be creating a Favourite Contacts app in MIT App Inventor, where you can save your most important contact numbers and call them with just one click. Let\u2019s get started! Open up MIT App Inventor. Start a new project and call it ContactsApp. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6636","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6636","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/comments?post=6636"}],"version-history":[{"count":1,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6636\/revisions"}],"predecessor-version":[{"id":6642,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/6636\/revisions\/6642"}],"wp:attachment":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/media?parent=6636"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}