App Inventor – Week 4 FavouriteBrowser

This week we will build an app has three buttons to launch our favourite websites.

  • The app will consist of three buttons across the top. The buttons will launch the Google website, the YouTube website and our own Athenry CoderDojo website.
  • We will also change the icon of the app from the default one supplied by App Inventor.


App Inventor - FavouriteBrowser


Getting started

Begin by dragging and dropping a HorizontalArrangement control from the Palette onto the screen. Rename this control to hsaButtons

Drag three buttons from the Palette and drop them onto the HorizontalArrangement control. Rename the buttons to btnGoogle, btnYouTube, btnCoderDojo. When dropping the buttons onto the HorizontalArrangement, try to ensure the buttons are overlapping. This will make sure they appear side by side.

Drag and drop a WebViewer control from the Palette onto the screen. Rename this control to wbvBrowser.


Creating the scripts

  1. Click the Blocks button.
  2. Select the btnGoogle Block.
  3. Select the “when btnGoogle.Click do” script.
  4. Select the wbvBrowser Block
  5. Select the “call wbvBrowser.GoToUrl” script
  6. Drag the “call wbvBrowser.GoToUrl” script and drop it into the “when btnGoogle.Click do” script.
  7. Drag a blank Text block and drop it at the end of the “call wbvBrowser.GoToUrl” script.
  8. In the blank Text Block type the full url of Google is
    1. Please remember to include the http://
  9. Test your app using an emulator or a mobile device

App Inventor - Launch Google


Launching the other web sites

  1. Repeat the steps above for the YouTube button and the CoderDojo button.
  2. The full url for YouTube is
  3. The full url for the Athenry CoderDojo is


Changing the default icon

A number of web sites exist that allow you to use free icons. Today we will use .

In this website you can search for your favourite icon.

  • For App Inventor the recommended icon size is 48 pixels * 48 pixels.
  • Save your favourite icon to your machine.
  • In App Inventor click the Designer button.
  • Upload the icon to your App Inventor project.
  • Select the Screen1 component.
  • Change the Icon property to the newly uploaded icon.

Please note: The new icon will only be visible when the app is installed on a mobile device.



Full steps are included in the following link

App Inventor Week 4 – FavouriteBrowser





CoderDojo Athenry Scratch Beginners Notes Used in AfriCoderDojo!

Recently, Eugene McDonough from the Hello World Foundation travelled to Nigeria to help start up a CoderDojo. To introduce groups to Scratch, he used none other than Martha Fahy’s Scratch Beginners notes from here in Athenry, beginning with the Jaws game that our Athenry ninjas will recognise very well!

You can read Eugene’s post here, and see if you can spot the Jaws game in pictures!

And of course as described in the last CoderDojo Athenry post, our mentor Oliver Thompson from CoderDojo Athenry recently did a live link-up to mentors starting up a CoderDojo in Tanzania, to go through the notes with them and answer their questions:


CoderDojo Athenry and Hello World Foundation Helping CoderDojos in Africa

Oliver Thompson, our lead mentor for the Scratch Advanced group in CoderDojo Athenry, recently did a live linkup to a new CoderDojo in Tanzania. Oliver’s notes on the experience are below.

Eugene from the Hello World Foundation ( originally contacted Michael from Coder Dojo Athenry ( with the fantastic idea of doing a Live Link up  with CoderDojo Athenry, CoderDojo Limierick and new CoderDojos in Tanzania and Nigeria. Eugene would be traveling to Africa to help set up new CoderDojos.

Many emails and phone calls later we had a tentative arrangement to Link up on Saturday the 8th of March, with a dry run scheduled for the Wednesday the 5th of March at the School.

Ciaran of Gairmscoil Mhuire VEC Athenry kindly gave permission to use the school during school time for this dry run, many thanks to the school for this.

Anyway, a few more emails back and forth between Athenry and Tanzania, events began to conspire against us. Internet access was not going to be good enough, if it existed at all.

It was at this point that we hit upon Plan B, I would get into work early on Tuesday 4th of March and we would try the connection from there. I duly arrived at around 6:00 am and got everything set up. And nothing happened! I sent a few emails, wondering where people were, no response, so packed up all my equipment and went back to work. And then Eugene came back on line, we were on for the trial run.

Packed up my equipment again and back to training room.

I Connected the laptop to the overhead projector, started up the Scratch Presentation.

Next was the tablet for the Skype session. I had brought my tripod in as well and in the best frontier tradition tied the tablet to the tripod with a bit of elastic. But hey, it worked a treat.

The tablet was set up in front of the big screen on the wall that had the Scratch Presentation on, so for the people at the other end it just looked like they were at a lecture, with me in front of the slides.

At the other end we had George and Godfrey who are the chief mentors for the new CoderDojos being set up, as well as one or two other people.

The Presentation went really well, Skype worked a treat, George and Godfrey could see all the slides and any Scratch code that I was showing them, it was just like being present at a lecture. Sound was no problem, even from a small tablet.

We spent about an hour on Skype, going through the Presentation and also demonstrating the code through Scratch as well.

It was looking good for the Main Event on Saturday 8th at this stage and I was figuring out if there was any better ways of presenting, and also if I could find anything better that a bit of elastic to hold the tablet to the tripod.

Unfortunately though, we could not go ahead on the Saturday as the location that was being used in Tanzania for the CoderDojo Session did not have a good internet connection.

The trial run and he Skype session were definitely worth doing, at the very least it proved that with a little bit of ingenuity (and elastic) that with fairly simple technology, a laptop, projector and tablet and the wonders of the Internet and Skype it is possible to run training sessions anywhere in the World.

This really was a “Hello World” moment.

– Oliver.

App Inventor – Week 3 The Countdown App

This week we will build an app that will count down the number of days, hours minutes and seconds to Christmas.

Countdown app

The app is modelled on the web site .

Getting Started

To create this app you need to drag and drop a two label components on to the screen. The first label is called lblTitle; this component fills the width of the screen. This label will be the Title displayed. The second label lblTimer also fills the width of the screen and is the countdown text in the app.

You also need to drag and drop a Clock component onto the screen. This component is not visible and will appear under the screen, all the default settings for this component are ok


Initializing Global variables

Click on the Blocks button to open the script editor. In the script editor a number of global variables must be created and initialized. The first variable is MillisecondsToChristmas, the initial value for this variable is zero. The other Global Variables are listed below and they are all set to zero.

  • DaysLeft
  • HoursLeft
  • MinutesLeft
  • SecondsLeft
  • MillisecondsForNow


When app starts calculate number of milliseconds to Christmas

When the app starts we use the Clock component to calculate the number of milliseconds to Christmas, this is stored in the Global variable MillisecondsToChristmas. Please note that the number of milliseconds calculated is not from the current time to Christmas but rather from Jan 01 1970. We will calculate the number of milliseconds for the current time later. Once we have this value we will subtract it from the number of milliseconds to Christmas.


Using the Clock Timer event to count down

The Clock component has a “Timer” event that fires every second. In this event we will calculate the number of milliseconds for the current time. This is stored in the Global variable MillisecondsForNow. The number of milliseconds for the current time is subtracted from the number of milliseconds to Christmas to give the number of milliseconds between now and Christmas. This is converted to seconds and stored in a local variable NumberOfSeconds. A number of local variables are needed

  • SecondsInMinute = 60
  • SecondsInHour = 3600
  • SecondsInDay = 86400
  • MinutesInHour = 60
  • HoursInDay = 24


Using the Clock Timer event to count down

In order to calculate the number of days, hours, minutes and seconds left to Christmas we use a couple of Math scripts

  • Modulo  – returns  the remainder of a division
  • Floor  – returns the greatest integer that’s less than or equal to the given number.

The script to calculate the Days, Hours, Minutes and Seconds is displayed below.

App Inventor - Final script

Full steps are included in the following link

Week 3 – Countdown App

Python/Pygame- Awarding Belts



Sorry for not posting for a while but as the group have been working on their own games for the past few weeks we haven’t looked at any new concepts.

This weekend we discussed awarding Belts. There are three belts available white, yellow and blue.

White belts are for ninjas who have attended at least five sessions and know how to get started with Idle.

Yellow belts are for ninjas who can demonstrate a basic understanding of coding with Python.

Blue belts will be awarded to ninjas who are more skilled coders.

Anybody who has attended more than five python sessions is entitled to apply for a belt so don’t worry if you haven’t attended for a while you can still get a belt.

Here are my slides from this week Belts.




App Inventor – Week 2 The Kitty App

This week we will create a Kitty App

When you swipe your finger over the picure of the Kitty the phone will play a meow sound and vibrate.


We begin by

  1. Creating a new project
  2. Uploading the picture of the Kitty to the App Inventor project
  3. Uploading the meow sound to the App Inventor project
  4. Drag and dropping a canvas to the app and changing the Background image
  5. Adding a script to play the meow soundand vibrate the phone when you swipe a finger over the picture of the Kitty


Week 2 – Kitty App

ModderDojo: Preparing to Earn Belts

Modding-PrepareForBeltsAs discussed at this week’s session, we will be awarding belts on Saturday 12 April. In advance of that, Modders should work on developing as good a mod as possible, in either Java or JavaScript. I can help you publish your mod to the CoderDojo Athenry website, so  get in touch with me (Michael) by email if you have questions.

Here are the notes in PDF format about how to earn a belt: Modding-PrepareForBelts.


ModderDojo Java Modding 13: All Our Mod Code So Far



Here is all of the code for our mods to define our first item, first block, and first recipe. In addition to 3 Java files, there is 1 language resource file (en_US.lang) and also 2 PNG files that are not included below: one for the block texture and one for the item texture.

Refer to the image below and to earlier posts in this series to see how these files should be arranged in a package.

// Michael Madden Feb 2014.
// Ref: 
// And: 

package modderdojo.firstitem;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;

public class MyFirstItem extends Item 
 public MyFirstItem() 
 // This is the constructor for our new item. Set basic properties in it.

// Michael Madden March 2014.

// Ref:
// And:

// Thanks to Ailish and Eli in CoderDojo Athenry who figured this out originally. 

package modderdojo.firstitem;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;

public class MyFirstBlock extends Block 
 public MyFirstBlock() 
 // This is the constructor for our new item. Set basic properties in it.
 super(Material.iron); // Copy the properties of iron
 setBlockName("MichaelFirstBlock"); // This is the internal name, not display name

// Michael Madden, March 2014.
// Registers an Item mod and a Block mod and creates a recipe.
// Ref:
// And:

package modderdojo.firstitem;

import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = "firstitem", name = "First Mod from ModderDojo by Michael", version = "1.0")
public class MyFirstMod
 public void preInit(FMLPreInitializationEvent event) 
 // Register my item and set its texture
 MyFirstItem first = new MyFirstItem();
 GameRegistry.registerItem(first, "MichaelFirstItem"); // This name doesn't have to be same as unlocalised name, but no harm in them being the same
 // Register my block and set its texture
 MyFirstBlock b = new MyFirstBlock();
 b.setBlockTextureName("modderdojo:mmblock"); // requires .png file with this name
 GameRegistry.registerBlock(b, "MichaelFirstBlock");
 // Add recipe to turn 2 of my items into diamond
 ItemStack myStack = new ItemStack(first);
 ItemStack diamond = new ItemStack(Items.diamond, 1);
 "x ", // 2x2 recipe
 " x", 
 'x', first);


en_US.lang Name For Michael's First Item's First Block Display Name