【发布时间】:2019-11-26 18:36:29
【问题描述】:
我创建了一个具有studId, studName, place 的表。我还想创建另一个与具有studId, day, timeone, timeTwo 的第一个表相关的表。我该怎么做?我是 firebase 的初学者
这个方法会为firebase添加数据
private void addDate(){
String studName = userName.getText().toString().trim();
String place = spinnerPlace.getSelectedItem().toString();
if(!TextUtils.isEmpty(studName)){
String id = databaseStudentData.push().getKey();
StudentData studentData = new StudentData(id, studName, place);
databaseStudentData.child(id).setValue(studentData);
addDay(id);
Toast.makeText(this, "Data is saved", Toast.LENGTH_LONG).show();
}else {
Toast.makeText(this, "you Should Enter your name", Toast.LENGTH_LONG).show();
}
}
这里是我存储的数据 enter image description here
【问题讨论】:
-
向我们展示一个具体示例,说明您想要实现的目标以及迄今为止您尝试过的目标。
标签: java android firebase firebase-realtime-database