java - Pushing accelerometer data into an array -


i'm having trouble recording z-axis data accelerometer in array.

i think i'm failing on basic java rules, here's i'm trying do:

    private arraylist<float[]> z = new arraylist<float[]>();             protected void oncreate(bundle savedinstancestate) {                      sensormanager manager = (sensormanager) getsystemservice(context.sensor_service);         sensor accelerometer = manager                 .getdefaultsensor(sensor.type_accelerometer); }             public void onsensorchanged(sensorevent event) {                   float x = event.values[0];                 float y = event.values[1];                 z.add(event.values[2]); } 

but whenever try add arraylist get:

"the method add(float[]) in type arraylist not applicable arguments (float)"

how can add z axis data array?

its because arraylist of float[] type.

replace following,

 private arraylist<float[]> z = new arraylist<float[]>(); 

with

 arraylist<float> z = new arraylist<float>(); 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -