I want to take data inside a folder of my Realtime Database that looks like this:
I have this code for getting the date range data and showing it in RecycleView .
DatabaseReference db = FirebaseDatabase.getInstance ( ).getReference ( );
DatabaseReference pendingRef = db.child ("Users").child ("Pending");
Query queryByKey = pendingRef.orderByKey ()
.startAt ("*" tanggalawal)
.endAt ("*" tanggalakhir "\uf8ff");
recView = (RecyclerView)findViewById (R.id.recview);
recView.setLayoutManager (new LinearLayoutManager (this));
FirebaseRecyclerOptions<Model> options =
new FirebaseRecyclerOptions.Builder<Model>()
.setQuery(queryByKey, Model.class)
.build();
adapter = new MyAdapter (options);
recView.setAdapter (adapter);
How can I get the DataPelanggan data inside of it?
CodePudding user response:
When you are using the Firebase-UI library for Android, it means that the adapter will be able to display only a flat list of objects based on the query that you pass in, creating one ViewHolder object for each element.
Since your actual data is located beneath nodes like DataPelanggan
, KTP
, and so on, that library isn't really helpful. If you can change the database schema like this:
Firebase-root
|
--- Pending
|
--- *20211127...
|
--- type: "DataPelanggan"