enhancement to accelerometer

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

enhancement to accelerometer

Postby neel » Sun Mar 16, 2008 10:09 pm


i want to enhance the functionality of accelerometer example given by plusminus

a simple view where initially the values [0,0,0] are displayed (as given in the tutorial of plusminus)

Consider the situation:
suppose initially the mobile device is kept on a table. so x,y,z will be [0,-1,0]. then if someone throws the phone so that it is falling and so x,y,z becomes [0,0,0].

so i want to make a UI whre initially it will show [0,-1,0] and then on clicking a button it simulates as if it the device falling so the x,y,z change to [0,0,0] and displays a message like "HEP I AM FALLING" :)

but i cant find any method which will allow me to set the initial x,y,z values to [0,-1,0].

is this possible......pls help or provide idea how to proceed

Posts: 31
Joined: Fri Feb 15, 2008 5:09 am
Location: San Jose


Postby plusminus » Fri Mar 21, 2008 11:30 am

Hello neel,

you could simply create a function that returns periodic values, i.e. calling [font=Lucida Console]value = Math.sin(System.currentTimeMillis());[/font].

Image | Android Development Community / Tutorials
User avatar
Site Admin
Site Admin
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany


Return to General

Who is online

Users browsing this forum: No registered users and 4 guests