I'm trying to get the room and i get error with my existing query, how can i make it work after getting the reference for room, how can i call or get the id encircled in the picture?
private void joinClass(cList ckey) {
FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef = database.getReference("StudentCourseList").child(currentUser.getUid()).push();
DatabaseReference ingDBref = FirebaseDatabase.getInstance().getReference("Room");
final String RoomCode=popupTitle.getText().toString();
ingDBref.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot data: dataSnapshot.getChildren()){
if(data.child("courseKey").getValue().equals(RoomCode)){
myRef.setValue(ckey);
showMessage("Joined Successfully");
popupClickProgress.setVisibility(View.INVISIBLE);
popupAddBtn.setVisibility(View.VISIBLE);
popAddCourse.dismiss();
}
else{
showMessage("Please verify room code");
popupAddBtn.setVisibility(View.VISIBLE);
popupClickProgress.setVisibility(View.INVISIBLE);
}
}
}