当我尝试在用户注册时将这些数据作为应用程序的设置插入数据库中时,Firestore云中没有任何反应,并且该应用程序没有给我任何错误 但是我在“运行”布局中看到的就是这个
D/ViewRootImpl@ac77a32[SetupActivity]: ViewPostIme pointer 0
D/ViewRootImpl@ac77a32[SetupActivity]: ViewPostIme pointer 1
I/zygote64: Background concurrent copying GC freed 24441(965KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 5MB/11MB, paused 199us total 212.292ms
D/ViewRootImpl@ac77a32[SetupActivity]: ViewPostIme pointer 0
D/ViewRootImpl@ac77a32[SetupActivity]: ViewPostIme pointer 1
I/zygote64: Background concurrent copying GC freed 185447(5MB) AllocSpace objects, 0(0B) LOS objects, 49% free, 5MB/11MB, paused 108us total 225.435ms
这是我需要实现的代码
public void createDept(View view){
assignDept();
for(int r=1; r<=Integer.parseInt(RoomsNumber);r++){
db.collection("Departments").document(Department)
.collection("Room").document(RoomsNumber).update("RoomNumber", RoomsNumber);
for(int b=1; b<=Integer.parseInt(BedsNumber);b++){
db.collection("Departments").document(Department)
.collection("Room").document(RoomsNumber)
.collection("Bed").document(BedsNumber)
.update("Active", false, "BedNumber", BedsNumber, "PatientId", "0");
db.collection("Departments").document(Department)
.collection("Room").document(RoomsNumber)
.collection("Bed").document(BedsNumber)
.collection("Sensors").document("1")
.update("ActiveState", false, "Type", "T&H");
db.collection("Departments").document(Department)
.collection("Room").document(RoomsNumber)
.collection("Bed").document(BedsNumber)
.collection("Sensors").document("2")
.update("ActiveState", false, "Type", "S");
}
}
}
private void assignDept(){
db.collection("Supervisor").document(SuperKey).update("Department", Department);
db.collection("Departments").document(Department).update("NumberOfRooms", RoomsNumber);
db.collection("Departments").document(Department).update("NumberOfBeds", BedsNumber);
db.collection("Departments").document(Department).update("Active", true);
}
有什么主意如何优化此代码以便可以运行? 谢谢