类“从FirestoreRecyclerAdapter派生的匿名类”

时间:2019-07-09 11:23:18

标签: java android error-handling

我需要帮助来纠正此错误:

  

类'从FirestoreRecyclerAdapter派生的匿名类'必须声明为抽象或在FirestoreRecyclerAdapter中实现抽象方法'onBindViewHolder(VH,int,T)'

https://i.gyazo.com/4cae34a0f04b7386d9477d004a01d044.png

代码:

private void firebaseUserSearch(String searchText) {

        Query firebaseSearchQuery =  mFirestore.collection("Users").startAt(searchText).endAt(searchText + "\uf8ff");

        FirestoreRecyclerAdapter<Users, UsersViewHolder> firebaseRecyclerAdapter = new FirestoreRecyclerAdapter<Users, UsersViewHolder>(

                Users.class,
                R.layout.user_list_item,
                UsersViewHolder.class,
                firebaseSearchQuery

        ) {
            @Override
            protected void populateViewHolder(UsersViewHolder viewHolder, Users model, int position) {
                viewHolder.setDetails(getContext(), model.getName(), model.getImage());

            }
        };

        mUsersListView.setAdapter(firebaseRecyclerAdapter);

    }

    public static class UsersViewHolder extends RecyclerView.ViewHolder {

        View mView;

        public UsersViewHolder( View itemView) {
            super(itemView);

            mView = itemView;

        }
        public void setDetails(Context ctx, String userName, String userImage){

            TextView user_name = (TextView) mView.findViewById(R.id.user_list_name);
            ImageView user_image = (ImageView) mView.findViewById(R.id.user_list_image);


            user_name.setText(userName);

            Glide.with(ctx).load(userImage).into(user_image);
        }
    }

0 个答案:

没有答案