MIT App Inventor
MIT App Inventor
• Handling Events
– Buttons (Action)
– Components (Behaviour)
What is App Inventor?
App Inventor is a visual programming
environment used to create mobile applications
for Android devices (phones/tablets).
Facts
◦ Originally created by Google Labs
◦ Now hosted at MIT
◦ Project is open source
Explore – Setup / Tutorials
http://appinventor.mit.edu
http://appinventor.mit.edu/learn/setup/setupwindows.html
http://appinventor.mit.edu/learn/setup/setupmac.html
AI - Projects
1. Component Designer
Define Graphical User Interface (GUI) and Non-GUI components
2. Blocks Editor
Determine the behaviour (algorithms and data structures) of the
components
• Component
Create
Test / Designer
User
Debug
Interface
optional
– Android phone/tablet
– device driver for Android device for live testing
Classroom environment
Development Steps
1. Open browser (Firefox or Chrome)
appinventor.mit.edu
2. Start emulator from desktop shortcut
3. Start Blocks Editor
Java application
4. Connect Blocks Editor
to emulator for testing
Notes:
Emulator takes a few minutes to start.
Each code change will be reflected in emulator.
Get Developing - Projects
An App Inventor Project is a collection of components
and blocks.
Open website
Log in using your GMAIL account
Available Actions
◦ Import existing project into new project
◦ Create new project
◦ Save/Export project
AI – Projects Page
AI Components / Events
Event based programming
Naming Conventions
◦ btnName – buttons
◦ txtName – textbox (later)
Reset 40 20 center
Score
Blocks Editor
◦ Locate the component (Screen1)
◦ Locate the set block and provide a valid value for the
property (BackgroundColor in this example)
HELLO KITTY
DEMO
Lab 1 - ColourMe
Objective
Create an interactive app that changes the colour of the screen on the
computer.
◦ Components
Buttons
Screen1
◦ Algorithms
When "red" button is clicked (Event)
change the screen colour to red (Event Handler).
Include buttons for "Green", "Blue"
Initially
The app should have a "white" background when it starts and the "Reset" button will reset the screen
Include a "Quit" button to close the application.
Lab 1 - ColourMe
App Inventor Skills
Screens
◦ properties
BackGroundColor
Buttons
◦ properties
Text
◦ Events
WhenClicked
Take it with you !!
If students have phones.
1. Create a QR code
◦ download to a phone (using developer
email)