{"id":2544,"date":"2010-10-27T15:40:07","date_gmt":"2010-10-27T13:40:07","guid":{"rendered":"http:\/\/blog.jteam.nl\/?p=2544"},"modified":"2010-10-27T15:40:07","modified_gmt":"2010-10-27T13:40:07","slug":"creating-an-android-app-with-google-app-inventor","status":"publish","type":"post","link":"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/","title":{"rendered":"Creating an Android app with Google App Inventor"},"content":{"rendered":"<p>After a few times filling in the registration form and weeks from waiting, I finally got an invite for <a href=\"http:\/\/appinventor.googlelabs.com\/about\/\" target=\"_blank\" rel=\"noopener\">Google App Inventor<\/a>. In this post I will explain how I have tried to rebuild an app that I created before with \u201cnormal\u201d programming.<\/p>\n<p><!--more--><\/p>\n<h2>Context<\/h2>\n<p>My little cousins like to play with my phone and press on every app that looks like it\u2019s going to be fun. So I thought it would be fun for them to have an app that could play animal sounds when you click on an image. It is a quite simple concept, but for me it was a good start to get to know the Android API. The result of the first version looks like this:<\/p>\n<p><a href=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none;padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"screen\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen_thumb.png\" border=\"0\" alt=\"screen\" width=\"173\" height=\"244\" \/><\/a><a href=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/farm.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none;padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"farm\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/farm_thumb.png\" border=\"0\" alt=\"farm\" width=\"173\" height=\"244\" \/><\/a><a href=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/cartoon.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none;padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"cartoon\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/cartoon_thumb.png\" border=\"0\" alt=\"cartoon\" width=\"173\" height=\"244\" \/><\/a><\/p>\n<p>As you can see the app has a three tabbed layout. Each tab contains a grid with images that listen to a click event.<\/p>\n<p>To explore the Google App Inventor a little bit more, I want to play a little video on the last tab when you click on an image.<\/p>\n<h2>App Inventor<\/h2>\n<p>Google App Inventor is split into two tools. The first is the App Inventor Designer, which allows you to create the pieces of your app by drag and drop components, such as buttons, text and pictures.<\/p>\n<p>The other one is the Blocks Editor. The Blocks Editor lets you assign behaviour to your components. In my case this would be playing a sound when you click a button.<\/p>\n<h2>Adding components<\/h2>\n<p>As I am trying to recreate my app, the first thing I tried to do was add the tabbed layout. But unfortunately tabs are not available (yet). For now I just continued with creating the Cartoon screen. This screen contains three images and when clicking on one of the images, a video should start playing below the images.<\/p>\n<p>The Designer provides me with three options to arrange the screen layout.<\/p>\n<p><a href=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screenArrangement.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none;margin: 0px 10px 0px 0px;padding-left: 0px;padding-right: 0px;float: left;padding-top: 0px;border: 0px\" title=\"screenArrangement\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screenArrangement_thumb.png\" border=\"0\" alt=\"screenArrangement\" width=\"226\" height=\"120\" align=\"left\" \/><\/a><\/p>\n<p>In order to create the layout with the images and the video player, I have used the <em>VerticalArrangement<\/em> component with a <em>HorizontalArrangement<\/em> component. This allows\u00a0 me to place the images in the <em>HorizontalArrangement<\/em> component and the video player below the images on the <em>VerticalArrangement<\/em> component.<\/p>\n<h3>Images<\/h3>\n<p>Now that the layout is in position, I can add the images to the <em>HorizontalArrangement<\/em> component. The first time I added an image, I just selected the <em>Image<\/em> component and dragged it onto my screen. This is fine, if you don\u2019t want to add any behaviour to the image. In my case I do want to add behaviour, so I have to use a <em>Canvas<\/em> component.<\/p>\n<p><a href=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/canvas1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none;margin: 0px 10px 0px 0px;padding-left: 0px;padding-right: 0px;float: left;padding-top: 0px;border: 0px\" title=\"canvas\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/canvas_thumb1.png\" border=\"0\" alt=\"canvas\" width=\"301\" height=\"162\" align=\"left\" \/><\/a><\/p>\n<p>The <em>Canvas<\/em> component provides us with the possibility to listen to a click event. To add my image to the <em>Canvas<\/em> I had to set the image as a background image.<\/p>\n<p>So now that all the images are in place, the only thing that is missing a video player component.<\/p>\n<h3>Video player<\/h3>\n<p>Adding a video player is as simple as dragging the <em>VideoPlayer<\/em> component to your screen. You can configure the video player with a source, but I left it blank. The Designer also contains a component called <em>Player<\/em>. This component is a non-visible component and can be configured with a source. In the images below you see the screen layout with the two <em>Player <\/em>components at the bottom.<\/p>\n<p><a href=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen1.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none;padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"screen\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen_thumb1.png\" border=\"0\" alt=\"screen\" width=\"153\" height=\"244\" \/><\/a><a href=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/components.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none;padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"components\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/components_thumb.png\" border=\"0\" alt=\"components\" width=\"396\" height=\"242\" \/><\/a><\/p>\n<p>Instead of playing a video, you can also play a sound. The Designer also contains a non-visible component <em>Sound <\/em>which can be used for playing short sounds. For longer sound files you can also use the <em>Player<\/em> component.<\/p>\n<p>Now that I have all the components ready, I can start the Blocks Editor to add behaviour to my images.<\/p>\n<h2>Adding behaviour<\/h2>\n<p>When you open the Blocks Editor you will find two tabs with blocks. The first tab contains all the built-In blocks, such as picking a colour or adding a procedure. The second tab contains the blocks for your components.<\/p>\n<p>In the image below I have added the (green) block that handles the behaviour of clicking on an image (or actually the canvas). The blue blocks set the source of the video player to the correct source and set the visibility of the player to true. The purple block tells the video player to start the video.<\/p>\n<p><a href=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/block_image.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none;padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"block_image\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/block_image_thumb.png\" border=\"0\" alt=\"block_image\" width=\"414\" height=\"212\" \/><\/a><\/p>\n<p>This block is repeated for each image with a different source. When a video is finished playing, I want the video to stop and the video player component to hide.<\/p>\n<p><a href=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/block_videoplayer.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none;padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px\" title=\"block_videoplayer\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/block_videoplayer_thumb.png\" border=\"0\" alt=\"block_videoplayer\" width=\"297\" height=\"135\" \/><\/a><\/p>\n<p>You may wonder why you see the Pause call in the purple block instead of the Stop call. This is actually wrong, but Google forgot to add a block for the Stop call <img decoding=\"async\" class=\"wlEmoticon wlEmoticon-smile\" style=\"border-style: none\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/wlEmoticon-smile.png\" alt=\"Glimlach\" \/> (See the bug report <a href=\"http:\/\/code.google.com\/p\/app-inventor-for-android\/issues\/detail?id=150&amp;q=stop&amp;colspec=ID%20Status%20Summary%20Reporter%20Stars\" target=\"_blank\" rel=\"noopener\">here<\/a>). I put the Pause call there to show my intensions. This is all the behaviour that is needed for now.<\/p>\n<h2>Conclusion<\/h2>\n<p><a href=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/result.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none;margin: 0px 10px 0px 0px;padding-left: 0px;padding-right: 0px;float: left;padding-top: 0px;border: 0px\" title=\"result\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/result_thumb.png\" border=\"0\" alt=\"result\" width=\"204\" height=\"244\" align=\"left\" \/><\/a>Although I wasn\u2019t able to completely recreate my application, I\u2019m very positive about the result that I was able to create with this piece of software. I like the fact that I was able to quickly create a basic app, but I was missing the real \u201cprogramming\u201d feeling. Maybe this is because Google App Inventor is still beta software and I wasn\u2019t able to enjoin all features.<\/p>\n<p>I am really curious about the full version and will definitely give it another try when it is released.<\/p>\n<p>Oh and my cousins love the app <img decoding=\"async\" class=\"wlEmoticon wlEmoticon-smile\" style=\"border-style: none\" src=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/wlEmoticon-smile.png\" alt=\"Glimlach\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>After a few times filling in the registration form and weeks from waiting, I finally got an invite for Google App Inventor. In this post I will explain how I have tried to rebuild an app that I created before with \u201cnormal\u201d programming.<\/p>\n","protected":false},"author":102,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[53,55,10],"tags":[25,209],"class_list":["post-2544","post","type-post","status-publish","format-standard","hentry","category-android","category-mobile","category-development","tag-android","tag-google-app-inventor"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Creating an Android app with Google App Inventor - Trifork Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Creating an Android app with Google App Inventor - Trifork Blog\" \/>\n<meta property=\"og:description\" content=\"After a few times filling in the registration form and weeks from waiting, I finally got an invite for Google App Inventor. In this post I will explain how I have tried to rebuild an app that I created before with \u201cnormal\u201d programming.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/\" \/>\n<meta property=\"og:site_name\" content=\"Trifork Blog\" \/>\n<meta property=\"article:published_time\" content=\"2010-10-27T13:40:07+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen_thumb.png\" \/>\n<meta name=\"author\" content=\"Roberto van der Linden\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Roberto van der Linden\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/\",\"url\":\"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/\",\"name\":\"Creating an Android app with Google App Inventor - Trifork Blog\",\"isPartOf\":{\"@id\":\"https:\/\/trifork.nl\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen_thumb.png\",\"datePublished\":\"2010-10-27T13:40:07+00:00\",\"author\":{\"@id\":\"https:\/\/trifork.nl\/blog\/#\/schema\/person\/037974cf3e24a7b09a93770b190d6e35\"},\"breadcrumb\":{\"@id\":\"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/#primaryimage\",\"url\":\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen_thumb.png\",\"contentUrl\":\"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen_thumb.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/trifork.nl\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Creating an Android app with Google App Inventor\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/trifork.nl\/blog\/#website\",\"url\":\"https:\/\/trifork.nl\/blog\/\",\"name\":\"Trifork Blog\",\"description\":\"Keep updated on the technical solutions Trifork is working on!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/trifork.nl\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/trifork.nl\/blog\/#\/schema\/person\/037974cf3e24a7b09a93770b190d6e35\",\"name\":\"Roberto van der Linden\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/trifork.nl\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/afe49faf7ef8dd3753baefb334568b10?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/afe49faf7ef8dd3753baefb334568b10?s=96&d=mm&r=g\",\"caption\":\"Roberto van der Linden\"},\"url\":\"https:\/\/trifork.nl\/blog\/author\/roberto\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Creating an Android app with Google App Inventor - Trifork Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/","og_locale":"en_US","og_type":"article","og_title":"Creating an Android app with Google App Inventor - Trifork Blog","og_description":"After a few times filling in the registration form and weeks from waiting, I finally got an invite for Google App Inventor. In this post I will explain how I have tried to rebuild an app that I created before with \u201cnormal\u201d programming.","og_url":"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/","og_site_name":"Trifork Blog","article_published_time":"2010-10-27T13:40:07+00:00","og_image":[{"url":"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen_thumb.png","type":"","width":"","height":""}],"author":"Roberto van der Linden","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Roberto van der Linden","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/","url":"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/","name":"Creating an Android app with Google App Inventor - Trifork Blog","isPartOf":{"@id":"https:\/\/trifork.nl\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/#primaryimage"},"image":{"@id":"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/#primaryimage"},"thumbnailUrl":"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen_thumb.png","datePublished":"2010-10-27T13:40:07+00:00","author":{"@id":"https:\/\/trifork.nl\/blog\/#\/schema\/person\/037974cf3e24a7b09a93770b190d6e35"},"breadcrumb":{"@id":"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/#primaryimage","url":"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen_thumb.png","contentUrl":"http:\/\/blog.jteam.nl\/wp-content\/uploads\/2010\/10\/screen_thumb.png"},{"@type":"BreadcrumbList","@id":"https:\/\/trifork.nl\/blog\/creating-an-android-app-with-google-app-inventor\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/trifork.nl\/blog\/"},{"@type":"ListItem","position":2,"name":"Creating an Android app with Google App Inventor"}]},{"@type":"WebSite","@id":"https:\/\/trifork.nl\/blog\/#website","url":"https:\/\/trifork.nl\/blog\/","name":"Trifork Blog","description":"Keep updated on the technical solutions Trifork is working on!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/trifork.nl\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/trifork.nl\/blog\/#\/schema\/person\/037974cf3e24a7b09a93770b190d6e35","name":"Roberto van der Linden","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/trifork.nl\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/afe49faf7ef8dd3753baefb334568b10?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/afe49faf7ef8dd3753baefb334568b10?s=96&d=mm&r=g","caption":"Roberto van der Linden"},"url":"https:\/\/trifork.nl\/blog\/author\/roberto\/"}]}},"_links":{"self":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/posts\/2544","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/users\/102"}],"replies":[{"embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/comments?post=2544"}],"version-history":[{"count":0,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/posts\/2544\/revisions"}],"wp:attachment":[{"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/media?parent=2544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/categories?post=2544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/trifork.nl\/blog\/wp-json\/wp\/v2\/tags?post=2544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}