Chapter 15 Challenge: An Empty View for the RecyclerView


can someone please give me a hint what kind of object is the best approach for this challange? I was thinking about a snackbar but I guess the idea behind this challange is something more simple as it is stated to make use of the visibility property that exists on any View class.

So I don’t know should it be a Fragment on top of my RecycleView Fragment,
or a DialogFragment on top of my RecycleView Fragment,
or something else?


Do you still need hellp? I just finished this challange and I could give you some pointers.


Hi Fabricio, yes please, what object did you use to apply the visibility property?


I added a textview in fragment_crime_list.xml and I wrapped it together with the recyclerview inside a constraintLayout. (I skpped the button part of the challenge)

And then in CrimeListFragment, inside the coroutine where one collects the crimes, one can check if a crime is empty and toggle the visibility for the textview and recyclerview accordingly and initialize the recyclerview adapter when appropriate.