App Inventor allows us to create apps for Android devices quickly and easily. It runs in the cloud. It is a web application that runs in a web browser.
To create a new project, visit the URL: appinventor.mit.edu. Click on the Create Apps! button. Sign in using your Google Account (click Allow if prompted). Click on the New Project button. Enter the Project Name and click OK.
Note the following points while naming your project:
a) The project name must begin with an alphabet.
b) Remaining characters may include alphabets, digits, or underscores.
c) Blank spaces are not allowed.
By default, the Designer view opens up. You can click on the Blocks button to switch to the Blocks view.
In the Designer view, the Pallette column has components that can be inserted to our app. The Viewer column displays the app’s screen. The Components column displays a list of all the components currently added to your project. The Media column allows us to manage the media files. The Properties column allows us to view and modify the properties of different components added to our project.
Every app must have a Screen component which acts as a container for all the other components. Each component must have a unique name. The default name for the Screen component is Screen1. App Inventor doesn’t allow you to change the name of this component.
Select the Screen1 component from the Components column and set its Title property from the Properties column. The Title property is displayed in the screen’s title bar.
The Label component displays text on the app’s screen. You can drag it from the Pallette to the screen and rename it using the Text property. The label’s Width and Height properties are used to adjust the size of the label. By default, they are set to Automatic. The Fill Parent value will make it as wide as the container it is enclosed in. You can also specify the size in pixels or in percentage.
It is always a good practice to rename different components (except Screen1) with meaningful names. Select the component. Click the Rename button to rename it.
To delete a component, select the component and click on the Delete button.
The Button component also has a Text property to change the text that appears on the button.
When multiple components are added, they are left aligned on the screen and are placed vertically (one below the other). The Screen component has AlignHorizontal (Left, Center, Right) and AlignVertical (Top, Center, Bottom) properties to set the alignment of the components horizontally and vertically.
The Hello World App
- Set the screen’s
AlignHorizontalproperty toCenterand theTitleproperty toHello World App. - Drag a Label component and clear its
Textproperty. Rename the component asLabelMessage. - Drag a Button and set its name to
ButtonDisplayMessageand itsTextproperty toClick Here to See a Message. - Note that apps are event-driven programs. An event is an action that takes place. Switch to Blocks view and select the
ButtonDisplayMessagecomponent and drag thewhen ButtonDisplayMessage.Click doblock. - Drag the set
LabelMessage.Text toblock and snap it inside the previous block. - Select the
Textdrawer and drag the text string block and snap it to the previous block. - Type
Hello Worldin the empty space.
The Good Morning Translator App
- Create a project named
GoodMorning. - Set Screen1’s
AlignHorizontalproperty toCenterandTitleproperty toGood Morning App. - The default BackgroundColor property of Screen1 is
White. Set it toLight Gray. - Drag a
Labeland rename it asLabelPhraseandTextproperty toGood Morning. Enable theFontBoldproperty and set theFontSizeproperty to24. - Drag a Button and rename it to
ButtonItalianand set itsTextproperty toItalian. - Drag another Button and rename it to
ButtonSpanishand set its Text property toSpanish. - Drag one more Button and rename it to
ButtonGermanand set itsTextproperty toGerman. - Switch to Blocks view. Drag when
ButtonItalian.Click doblock and snapset LabelPhrase.Text toblock inside it. Add an empty string to it and enterBuongiomoin it. - Similarly, for Spanish it should be
Buenos Diasand for German it should beGuten Morgen.