当我将mPostFef作为参数添加时,出现错误,我不知道它是什么意思:
我认为这可能不是编码的正确方法。预先感谢您的任何建议。
private RecyclerView mPostRV;
private FirebaseRecyclerAdapter<Post, PostViewHolder> mPostAdapter;
private DatabaseReference mPostRef;
private void initialiseScreen() {
mPostRV = (RecyclerView) findViewById(R.id.post_rv);
mPostRV.setLayoutManager(new LinearLayoutManager(MainActivity.this));
mPostRef = FirebaseDatabase.getInstance().getReference(Constants.POSTS);
setupAdapter();
}
private void setupAdapter() {
mPostAdapter = new FirebaseRecyclerAdapter<Post, PostViewHolder>(
Post.class,
R.layout.item_layout_post,
PostViewHolder.class,
mPostRef
) {
@Override
protected void onBindViewHolder(PostViewHolder holder, int position, Post model) {
}
@NonNull
@Override
public PostViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
return null;
}
}
}
public static class PostViewHolder extends RecyclerView.ViewHolder {
public PostViewHolder(View itemView) {
super(itemView);
}
}