I’m now connecting to a BLE device via my Android APP, and add the received data to an ArrayList. When a button is pressed, I’m writing the data in this ArrayList to Firebase. However, I’m wondering if there is any better way to perform the writing process since the ArrayList size might be large when I hit the button and start to write. The following is my code:
List<HashMap> dataBufferList = new ArrayList();
HashMap<String, String> data = new HashMap<>();
data.put("HR", ","80");
data.put("GPS","20.75,56.98");
data.put("Time", getCurrentTime(sdf));
dataBufferList.add(data);
for(int i = 0 ; i < dataBufferList.size();++i){
myRef.push().setValue(dataBufferList.get(i));
}
dataBufferList.clear();