Can not resolve symbol 'viewHolder'....And when I change it to 'holder' nothing is changed ...
this is part of my code (the Custom Class)
My code :
private void DisplayAllUsersPosts() {
FirebaseRecyclerAdapter<Posts, PostsViewHolder> firebaseRecyclerAdapter =
new FirebaseRecyclerAdapter<Posts, PostsViewHolder>(Posts.class, R.layout.all_posts_layout, PostsViewHolder.class, PostsRef) {
@Override
protected void onBindViewHolder(@NonNull PostsViewHolder holder, int position, @NonNull Posts model) {
viewHolder.setFullname(model.getFullname());
viewHolder.setTime(model.getTime());
viewHolder.setDate(model.getDate());
viewHolder.setDescription(model.getDescription());
viewHolder.setProfileimage(getApplicationContext(), model.getProfileimage());
viewHolder.setPostimage(getApplicationContext(), model.getPostimage());
}
@NonNull
@Override
public PostsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.all_posts_layout, parent, false);
PostsViewHolder viewHolder = new PostsViewHolder(view);
return viewHolder;
}
};
postList.setAdapter(firebaseRecyclerAdapter);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…