如何在Firebase中显示出勤的所有姓名?

时间:2018-11-12 09:10:42

标签: android firebase firebase-realtime-database

作为问题,如何显示事件的所有checkInName?从下面的代码中,我已经能够从

获取事件名称。
String attendance = intent.getStringExtra("Attendance"); 

但是如何在回收视图中显示它?

package com.example.edward.neweventmanagementsystem;

import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.edward.neweventmanagementsystem.Model.AttendanceInfo;
import com.example.edward.neweventmanagementsystem.ViewHolder.MenuViewHolder;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.firebase.ui.database.FirebaseRecyclerOptions;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;

public class attendanceListMainList extends AppCompatActivity {

    RecyclerView recycle_menu;
    RecyclerView.LayoutManager layoutManager;
    private DatabaseReference mDatabaseReference;
    FirebaseRecyclerAdapter<AttendanceInfo, MenuViewHolder> adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_attendance_list_main_list);

        mDatabaseReference = FirebaseDatabase.getInstance().getReference().child("AttendanceRecord");

        searchAttendance();

    }

    public void searchAttendance() {

        Intent intent = getIntent();
        String attendance=  intent.getStringExtra("Attendance");
        System.out.println("Test in StaffAttendanceRecordTable: "+attendance);

    }
    @Override
    public void onBackPressed() {
        Intent intent = new Intent(this, StaffAttendanceRecordTable.class);
        startActivity(intent);
    }

}

Sample

0 个答案:

没有答案