Sie sind auf Seite 1von 14

MAGIC CRYSTAL BALL

PREDICTION
USING ACCELEROMETER, LIST AND NOTIFIER
OBJECTIVES:
USING ACCELEROMETER, LIST AND NOTIFIER
Open MIT App Inventor account -> Project Name: CrystalBallSurname Section

Layout the Screen1 (Make your own design)

Screen1 background image

Buttons with background image

Rename each
components and
add notifier1 on
the screen.
Layout the Screen2
(How to add another screen?)
Screen2 background image

HorizontalArrangement
with label inside

Textbox with hint Type your question here...

Buttons inside the


HorizontalArrangement
Rename each components

Uncheck the property visible of


HorizontalArrangement1

Add AccelerometerSensor and


uncheck the enable property
Screen1 Blocks
Code Blocks that link to the
another screen

Just simply type your question. Click the submit button


and shake your phone to determine your future.

Code Blocks that show a


dialog box where the
instruction can be seen.

Code Blocks that close the


application
Notifier
The Notifier component displays alert dialogs,
messages, and temporary alerts, and creates Android
log entries.

Sample Code Block

Sample Notifier
Screen2 Blocks

Blocks where the AcceleromenterSensor


will be enabled and the submit button
will be disabled
Screen2 Blocks
Blocks that will trigger the accelerometer by
shaking the device.

List of
predictions

Blocks that will served as container of a random answer from


the item list and the HorizontalArrangement become visible
List Block

Lists are a type of data


structure used in every
programming language, not
just App Inventor. Lists is use
to create and manipulate
different sets of values.
AccelerometerSensor
Non-visible component that can detect shaking and
measure acceleration approximately.

Sample Code Block


Screen2 Blocks

Blocks that will reset the application to its default


settings.
App Inventor Challenge

Add sound effects every time the


submit button is tapped/clicked.

Make all the prediction speak/talk once


the device is shaked.

Das könnte Ihnen auch gefallen