title: How to use get Android's acceleration with specified times?
body: <p>I am a java newer,</p>
  
  <p>I want to get, for example, 10 different values of my phone's acceleration,</p>
  
  <p>and get an average value from them.</p>
  
  <p>But I can only find answers for continued data, or only one data.</p>
  
  <p>Now I can get one data and display it on my screen.</p>
  
  <p>Can I use for loop to calculate for 10 times?</p>
  
  <p>Thank you.</p>
  
  <pre><code>public void onSensorChanged(SensorEvent event) {
      // TODO Auto-generated method stub
      aAngle = event.values[0];
      bAngle = event.values[1];
  }
  
  private Button.OnClickListener listener = new Button.OnClickListener() {
  switch(viewMode){
  case VIEW_MODE_1:
  title.setText(Double.toString(aAngle) + " " + Double.toString(bAngle));
              break;}
  </code></pre>
  
  <p>I've tried to cast a for loop in the OnSensorChanged method, but it didn't work at all.</p>