Home » Android » How to display data in Firebase RecyclerView UI from Firebase using Id's from Geofire

How to display data in Firebase RecyclerView UI from Firebase using Id's from Geofire

Posted by: admin November 1, 2017 Leave a comment

Questions:

I have an app I am working on that needs live queries using location from the user. Writing to the geofire node is okay but I have trouble on reading. Once I get the id’s how do I make a query with them and display data using the firebase recycleradapter?
Here is my code so far (without Geofire):

    FirebaseRecyclerOptions<Venue> options =
            new FirebaseRecyclerOptions.Builder<Venue>()
                    .setQuery(filterRef, Venue.class)
                    .build();
    adapter = new FirebaseRecyclerAdapter<Venue, VenueViewHolder>(options) {
        @Override
        public VenueViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            View view = LayoutInflater.from(parent.getContext())
                    .inflate(R.layout.single_venue_item, parent, false);

            return new VenueViewHolder(view);
        }

        @Override
        protected void onBindViewHolder(final VenueViewHolder holder, final int position, Venue model) {

            final String venueName = model.getVenueName();
            holder.venueName.setText(venueName);

            Glide.with(holder.mView.getContext())
                    .load(model.getVenueMainImage())
                    .apply(new RequestOptions()
                            .placeholder(R.mipmap.ic_launcher_round))
                    .into(holder.venueMainImage);

        }
    };

    venuesRecyclerView.setLayoutManager(mLinearLayoutManager);
    venuesRecyclerView.setAdapter(adapter);
Answers: