android - How to store a Light sensor value in an array for a long time ? 1 sample / 2sec -


i'm developing app personal project , , need process data later on on matlab (for power requirements). hence, goal "store" value of light sensor every 2 second, in array ? right now, able correctly show value of sensor in real time, displayed on screen based on default frequency of smartphone ! i'm quite novice in android, , i'm learning everyday haha ! i'm stuck there... final goal send data database , create graph of later on .. showing light intensity of place in term of time .. best storage please? best regards,

private final sensoreventlistener lightsensorlistener = new sensoreventlistener() {     @override     public void onsensorchanged(sensorevent event) {         if(event.sensor.gettype() == sensor.type_light){             textlight_reading.settext("light : " + event.values[0]);         }     }     @override     public void onaccuracychanged(sensor sensor, int accuracy) {      } }; 

and here other part of code :

textlight_available = (textview) findviewbyid(r.id.light_available);     textlight_reading = (textview) findviewbyid(r.id.light_reading);       sensormanager mysensormanager = (sensormanager) getsystemservice(sensor_service);     sensor lightsensor = mysensormanager.getdefaultsensor(sensor.type_light);      super.onresume();     if (lightsensor != null) {         textlight_available.settext("light sensor on");         mysensormanager.registerlistener(lightsensorlistener, lightsensor,                 sensormanager.sensor_delay_normal);     } else {         textlight_available.settext("light sensor off");     } 

as per description need store data every 2 seconds guess huge amount of data depending on time

first may create array of data objects , keep on adding items every 2 seconds , keep on pushing array sqlite database every minute persistent storage

if go writing sqlite db every 2 seconds may lead issues

happy coding :)


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -