Meaningless Drivel is fun!
The moose likes Android and the fly likes Accelerometer Problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Accelerometer Problem." Watch "Accelerometer Problem." New topic

Accelerometer Problem.

Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Hi Friends,

I am doing some stuff with accelerometer. I am able to access this sensor using Sensor Listener service.As you all know it gives three values X,Y and Z. Now what this values are.
I got some info from google. But still I am not sure about it.

Can anyone elaborate those three values to me? I want to detect that user is walking or not? I want to detect the distance the user has walked.

Please Help.
Peter Johnson

Joined: May 14, 2008
Posts: 5852

I would suspect that the three values represent the acceleration in each of the three directions of a 3-D graph (you know, that boring geometry stuff you slept through in math class ;) ). My guess is that if you lay your phone flat, the X axis goes left/right relative to the device, the Y axis goes forward/backwards (or rather away from the top and bottom of the device), while Z is up/down (that is upwards from the screen or downwards from the back of the device). A simple app that displays the values should be able to verify this.

I google and found this post which seems to agree the directions:

JBoss In Action
Hardik Trivedi
Ranch Hand

Joined: Jan 30, 2010
Posts: 252
Thanks Peter...
I agree. Here's the link:
subject: Accelerometer Problem.
It's not a secret anymore!