Reputation: 171
I'm trying to run a query on my firebase database in order to return only those results where timestamp = the date specified in the date picker (see picture of app) I want this query to run whenever I press the view records button
[![Firebase][3]][3]
I am able currently to print out all objects into the recycler view, however when attempting to run my query its not producing any results, no errors and no faults in debugging
If I need to provide anymore detail please let me know
[3]: https://i.sstatic.net/d2uu2.png
Upvotes: 1
Views: 207
Reputation: 138969
To solve this, please change the following line of code:
options = new FirebaseRecyclerOptions.Builder<Records>().setQuery(databaseReference, Records.class).build();
to
options = new FirebaseRecyclerOptions.Builder<Records>().setQuery(query, Records.class).build();
// ^ ^
You have to pass to the setQuery()
method the query
object and not the databaseReference
object because the query object actually filters your data.
Edit:
According to your comment:
Yep its working when hardcoded, but it's not working when getting the text view to string
This means that passing the query object did the trick but the problem remains on how you convert the data to String. To sovle this, be sure that the String representation of the date
is of type: 04-02-2017
and your problem will be solved.
Upvotes: 1