我尝试使用firebase向recyclerview添加一个“on touch”侦听器,但无法成功。谁能帮我?
DatabaseReference ref = FirebaseDatabase.getInstance().getReference();
DatabaseReference a = ref.child("ufile").child(unique_id).child("Files");
final FirebaseRecyclerAdapter<usersinfo,MessageViewHolder>adapter =
new FirebaseRecyclerAdapter<usersinfo, MessageViewHolder>(usersinfo.class,android.R.layout.two_line_list_item,MessageViewHolder.class,a) {
@Override
protected void populateViewHolder(MessageViewHolder viewHolder, usersinfo model, int position) {
viewHolder.mtext.setText(model.username);
}
};
rvdb.setAdapter(adapter);
public static class MessageViewHolder extends RecyclerView.ViewHolder {
TextView mtext;
public MessageViewHolder(View itemView) {
super(itemView);
mtext = (TextView) itemView.findViewById(android.R.id.text1);
}
}
public void retriveinfo(String username, String adress,String unique_id){
DatabaseReference mDatabase;
mDatabase = FirebaseDatabase.getInstance().getReference();
usersinfo newuser= new usersinfo(username,adress);
}