How to use get Android's acceleration with specified times?

Saturday, July 5, 2014

I am a java newer,

I want to get, for example, 10 different values of my phone's acceleration,

and get an average value from them.

But I can only find answers for continued data, or only one data.

Now I can get one data and display it on my screen.

Can I use for loop to calculate for 10 times?

Thank you.