android setting up recyclerview inside a fragment 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