Accelerometer Demo



Target :


Android Application


Android 2.2 (API level 8)

Archos 28 tablet

Source Code:

version 1.0


Software License:

Description :

This is a simple Android application that visualizes the real time output of the accelerometer that is inside of the Archos 28. Every time new accelerometer data is received (about 20 time a second) the visualization is redrawn. Tap anywhere on the screen to close the application.

User Interface :

    • The accelerations on each axis are displayed in meters per second squared at the top (z is towards the ground)

    • The blue arrow shows the acceleration vector.

Code Overview :


  • www.projectbiped.AccelerometerTest : the collection of code that contains the user interface and logic.


    • Extends the Activity class

      • allows it to be run as an application

    • Implements the SensorEventListener interface

      • allows it to get feedback on the accelerometer output

    • The main activity for the application

    • Creates the AccelerometerView and sets it as the full screen view

    • Registers a listener for the accelerometer sensor (lines 58 and 59)

    • Sends accelerometer info to the AcelerometerView to be visualized (see the onSensorChanged method)

    • Extends the View class

      • allows it to display information to the screen

    • onDraw() method that renders the visualization

    • setAccelerometerMeasurement() is called by the AccelerometerTestActivity

      • triggers a redrawing of the visualization by calling the invalidate() method


  • Specifies that AccelerometerTestActivity is the activity that should be run once the application starts up

Dependencies :

  • Requires that attached Android device has an accelerometer (the Archos 28 has an accelerometer).

Installation :

  1. Setup the Android development environment on your computer.

  2. Download the source folder for this application.

  3. Open Eclipse on your computer.

  4. Add this application to your work space.

    1. From the main menu : File / Import / Android / Existing Android Code Into Workspace

    2. Select the folder you downloaded that has the source code for this application.

  5. Make sure all of the dependencies have been met.