Have an account?

Monday, July 19, 2010

HelloPurr: A Tutorial Introduction to App Inventor

Creating applications involves selecting components and writing simple programs to make them interact.

You'll build the application in four steps:
1. Add a button to trigger an event.
2. Add a player component to play the meow sound.
3. Define an event handler that tells the button to play the sound when you click the button.
4. Package the application and download it to the phone.
Add a Label
Add a label at the top of the screen to serve as a title.
1. Open your browser to the App Inventor for Android server at http://androidblocks.googlelabs.com.
The browser should open to show the Designer window.
2. Click the Projects tab, then the New button.
Fill in the project name as HelloPurr.
Make sure not to leave a space between Hello and Purr.
3. Click OK.
The designer automatically switches to the Design tab.
4. Drag a Label component from the Palette over to the Designer panel.
You should see the Label's properties on the right.
5. Change the ID of the label to Message by changing the text in the ID box at the top of the Properties panel and pressing return.
You should see the name of the label change in the Components panel.
6. In the Properties panel, change the Text of the label to Pet the Kitty.
You should see the image of the label in the Viewer change to show the new text.
7. In the Properties panel, change the BackgroundColor of the label to yellow.
8. Change the TextColor of the label to blue.

Add a Button
1. Make sure you are in the Application Designer.
2. Drag a Button from the Palette to the viewer.
3. Change the ID of the Button to KittyButton and change the Text of the Button to Pet me.
4. We want to make the Button show a picture of the kitty.
Look at the button's properties in the rightmost panel.
If you don't see the properties, click on the button in the Components panel to select it.
You'll see that the button's image is currently set to None...
5. Click on the word None.. in the Image field.
A window opens which shows all the assets, auxiliary files, for the project. Currently there are no assets.
6. Let's add the picture of a kitty from the desktop.
Click Add.
You should see a file selection window appear.
7. Browse to your desktop to select kitty.png.
8. Click OK in the selection window.
The selection window disappears and you should see kitty.png added as the button's image.
Note: The maximum size for any one file is 1 MB. The size limit for all uploads is 5 MB per project.
9. Just for fun, click on the Preview tab in at the top of the Viewer.
In about 10 seconds you should see a better rendition of what your application will look like on the phone, with the image of the kitty.
10. Now click the Design button in the Viewer pane to return to the Design mode.


Adding the label

Under Palette
  1. Drag and drop the Label component to the Viewer, placing it below the kitty. It will appear under your list of components as Label1
Under Properties
  1. Change the Text property of Label1 to read "Pet the Kitty". You'll see the text change in the Designer and on your device.
  2. Change the BackgroundColor of Label1 by clicking on the box
  3. Change the TextColor of Label1
  4. Change the FontSize of Label1 to 30

Adding the meow sound

Under Palette
  1. Click on the header marked Media to expand the Media section of the palette of components.
  2. Drag out a Sound component and place it in the Viewer. Wherever you drop it, it will appear in the area at the bottom of the Viewer marked Non-visible components.
Under Media
  1. Click Add...
  2. Upload the meow.mp3 file to this project.
Under Properties
  1. For the Sound1 component, set its Source to meow.mp3.

For more detailed information, please click here

Good Luck !