添加数据库引用后,FirebaseRecylerAdapter会出错

时间:2017-10-18 17:08:08

标签: android firebase firebase-realtime-database recycler-adapter firebaseui

这行代码给了我红线错误。我不知道我做错了什么。当我输入"新的FirebaseRecyclerAdapter"时,我会注意到一件事。它给了我覆盖方法2而不是1,这是onPopulateViewHolder在Youtube上的TVAC视频教程中看到的缺失。

这是代码:

public class ViewListTutor extends AppCompatActivity {

private RecyclerView mListTutor;
private DatabaseReference mlistDatabase;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_list_tutor);
    mlistDatabase = FirebaseDatabase.getInstance().getReference().child("Users").child("Tutors");
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);



    mListTutor = (RecyclerView) findViewById(R.id.tutor_list);
    mListTutor.setHasFixedSize(true);
    mListTutor.setLayoutManager(new LinearLayoutManager(this));

}

@Override
protected void onStart() {
    super.onStart();

    FirebaseRecyclerAdapter<ListTutorItem, TutorViewHolder> FirebaseRecyclerAdapter = new FirebaseRecyclerAdapter<ListTutorItem, TutorViewHolder>(

            ListTutorItem.class,
            R.layout.tutor_row,
            TutorViewHolder.class,
            mlistDatabase
    ) {
        @Override
        protected void onBindViewHolder(TutorViewHolder holder, int position, ListTutorItem model) {

        }

        @Override
        public TutorViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            return null;
        }
    };

}

图像:

example

我对UI Firebase数据库的依赖:

    compile 'com.firebaseui:firebase-ui-database:0.4.0'

0 个答案:

没有答案