Я хочу добавить данные в firebase child, используя hashMap с массивом и для цикла.Но значение перезаписывается вместо создания нового потомка с новым индексом.Вот код:
for (int i = 0; i < 10; i++) {
medicineName[i] = medName[i].getText().toString();
HashMap<String, String> anxietyData = new HashMap<>();
anxietyData.put("medicine_date", medDate);
anxietyData.put("medicine_name" + i, medicineName[i]);
mref.child("users").child(mAuth.getCurrentUser().getUid())
.child("data").child("medicine_detail").setValue(anxietyData);
}
Это значение базы данных:

Надеюсь, код понятен.Пожалуйста, помогите мне.Спасибо