我想将ondatachange数据快照getValue插入到Firebase RecyclerView适配器中
这是我过滤的数据快照值
mDatabase = FirebaseDatabase.getInstance().getReference();
mDatabase.keepSynced(true);
query_car = mDatabase.child("customerRequest").orderByChild("vehicle_num").startAt(start).endAt(end);
query_car.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
for(DataSnapshot d : dataSnapshot.getChildren()){
request_recycle direction = d.getValue(request_recycle.class);
if(direction.getDirection().equals("4")){
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// request_list.setAdapter((RecyclerView.Adapter) Objects.requireNonNull(d.getValue()));
// }
Log.e("dsfsd", request_list.toString());
}
}
}
我想将值传递到recyclerview适配器
public void onStart() {
super.onStart();
FirebaseRecyclerOptions<request_recycle> options = new FirebaseRecyclerOptions.Builder<request_recycle>().setQuery(query_car,request_recycle.class).build();
final FirebaseRecyclerAdapter adapter = new FirebaseRecyclerAdapter<request_recycle,requestViewHolder>(options) {
@NonNull
@Override
public requestViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.request_trip_layout, viewGroup, false);
return new requestViewHolder(view);
}
@Override
protected void onBindViewHolder(@NonNull final requestViewHolder viewHolder, int position, @NonNull final request_recycle model) {
``