Professional Documents
Culture Documents
1/6 blog.androgames.net/85/android-accelerometer-tutorial/
Andogame blog
Android Deelopment & Game
Home
Android Accelerometer Sensor tutorial
Posted by Tonio | Filed under Tutorial
Android supports a wide variety of sensors that can be used by applications to capture
informations about the phones environment.
In this tutorial, well see how to use the accelerometer sensor in an application in order to capture
acceleration change events. Well use these events to build a custom liene that will trigger
others events such as shake events :
package net.androgames.bolg.sample.accelerometer;
pblic inerface AccelerometerListener {
pblic oid onAccelerationChanged(floa x, floa y, floa z);
pblic oid onShake(floa force);
As usual, it is preferable to register listeners in the onResume() method of the Activity and
removed in the onFinish() method of the Activity.
You can browse the full source code of the Eclipse project here : SampleAccelerometerSensor
Enjoy !
Tags : accelerometer, gesture, sensor, shake
Permalink March 6th, 2010
Leave a Repl
Name
Mail (ill not be published)
Website
12/5/11 Androgames Android Accelerometer Sensor tutorial
6/6 blog.androgames.net/85/android-accelerometer-tutorial/
Webie
Commen
Sbmi Commen
Recent Posts
Aomaic Andoid obfcaed bild
Andoid iled backgond
Andoid TakKille applicaion
Andoid com Dialog
Andoid Bbble Leel applicaion
Links
Andoid make - Andoid make official ie
Deelope eoce - Andoid deelope' gide
Tonio' Blog - Andoid oial in Fench
About
Copyright 2011 Andogame blog