I'm working on an Android project where the subject is to develop an android application to gather data from an external sensor (phidgets) and then generate a graphic representation using graphview or similar. The question i would like to expose is how to save the real time data to the DataPoint[] structure. I've tried with while and for methods using number of points or time.
DataPoint[] data_ax = new DataPoint[number of points];
data_ax[i] = new DataPoint(i,onDataEvent.getData()[0].getAcceleration()[0]);
or with a for cycle
DataPoint[] data_ax = new DataPoint[number of points];
for (int i = 0;i<30;i++){
data_ax[i] = new DataPoint(i,onDataEvent.getData()[0].getAcceleration()[0]);
}
while cycle
long t= System.currentTimeMillis();
long end = t+15000;//15*1000 seconds
while(System.currentTimeMillis() < end) {
String[] data_az = new String[];
int x=0;
data_az[x]= onDataEvent.getData()[0].getAcceleration()[0]);
x=x+1;
}
I can't seem to find the correct way to do it. Thank you for your answers.