Android 2.2 (API level 8)
Archos 28 tablet
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
Requires that attached Android device has an accelerometer (the Archos 28 has an accelerometer).
Setup the Android development environment on your computer.
Download the source folder for this application.
Open Eclipse on your computer.
Add this application to your work space.
From the main menu : File / Import / Android / Existing Android Code Into Workspace
Select the folder you downloaded that has the source code for this application.
Make sure all of the dependencies have been met.