Получение данных из базы данных о пожаре возможно при просмотре списка таким способом
Но я не могу решить установить значение в табличной форме.Как я могу изменить этот код для извлечения данных в табличной форме?
//Database Connection
database = FirebaseDatabase.getInstance();
myRef = database.getReference("Students");
//Retriving data from the firebase in ListView
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
//Making array
List<Students> list = new ArrayList<>();
for(DataSnapshot dataSnapshot1 :dataSnapshot.getChildren()){
Students userdetails = dataSnapshot1.getValue(Students.class);
Students listdata = new Students();
String student_id =userdetails.getStudentId();
String student_fullname =userdetails.getStudentName();
String student_RollNumber =userdetails.getRollNumber();
String studentEnrollmentNumber =userdetails.getEnrollNumber();
String student_Division=userdetails.getDivision();
String student_Standard =userdetails.getStandard();
String studentLoginUser =userdetails.getLoginUser();
String studentloginPassword =userdetails.getLoginPassword();
String student_BirthDate =userdetails.getBirthDate();
String studentAddress =userdetails.getAddress();
String studentParentPhone =userdetails.getParentPhone();
String student_batch =userdetails.getBatch();
//Setting values
listdata.setStudentId(student_id);
//setting student_id with list data
listdata.setStudentName(student_fullname);
//setting student_fullname with list data
listdata.setRollNumber(student_RollNumber);
//setting student_RollNumber with list data
listdata.setEnrollNumber(studentEnrollmentNumber);
//setting studentEnrollmentNumber with list data
listdata.setDivision(student_Division);
//setting student_Division with list data
listdata.setStandard(student_Standard);
//setting student_Standard with list data
listdata.setLoginUser(studentLoginUser);
//setting LoginUser with list data
listdata.setLoginPassword(studentloginPassword);
//setting LoginPassword with list data
listdata.setBirthDate(student_BirthDate);
//setting studenBirthDate with list data
listdata.setAddress(studentAddress);
//setting studentAddress with list data
listdata.setParentPhone(studentParentPhone);
listdata.setBatch(student_batch);
list.add(listdata);
}
//Displaying values in the ListView
UserCustomAdapter recycler = new UserCustomAdapter(list);
//Creating adapter class
RecyclerView.LayoutManager layoutmanager = new LinearLayoutManager(adminteacherData.this);
//Adding adapter
recyclerview.setLayoutManager(layoutmanager);
recyclerview.setItemAnimator( new DefaultItemAnimator());
recyclerview.setAdapter(recycler);
}