adding recyclerview on a fragment android studio code example

Example: add recyclerview in fragment

recyclerView1.apply {
            // set a LinearLayoutManager to handle Android
            // RecyclerView behavior
            layoutManager = LinearLayoutManager(activity)
            // set the custom adapter to the RecyclerView
            val notificationobjects : MutableList<Notification> = mutableListOf<Notification>()
            notificationobjects.add(Notification("Zainab Al Khalifa", "Grade-I"))
             recyclerView1.adapter = NotificationAdapter(notificationobjects)

        }

Tags:

Misc Example