{"id":328,"date":"2022-11-01T10:23:36","date_gmt":"2022-11-01T10:23:36","guid":{"rendered":"https:\/\/jassweb.com\/new22\/solved-how-to-use-recyclerview-in-kotlin\/"},"modified":"2022-11-01T10:23:36","modified_gmt":"2022-11-01T10:23:36","slug":"solved-how-to-use-recyclerview-in-kotlin-2","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/","title":{"rendered":"[Solved] How to use RecyclerView in kotlin"},"content":{"rendered":"<h2> Introduction <\/h2>\n<p>[ad_1]<\/p>\n<p>RecyclerView is a powerful tool for displaying large amounts of data in a user-friendly way. It is a part of the Android Jetpack library and is used to display large datasets in a list or grid format. It is an efficient way to display data and can be used with Kotlin to create a powerful and efficient user interface. In this article, we will discuss how to use RecyclerView in Kotlin. We will cover the basics of RecyclerView, how to set it up, and how to use it to display data. We will also discuss some of the best practices for using RecyclerView in Kotlin.<\/p>\n<h2> Solution<\/h2>\n<p><\/p>\n<p>Below is a sample code to use RecyclerView in Kotlin:<\/p>\n<p>\/\/ Create a RecyclerView<br \/>\nval recyclerView = RecyclerView(this)<\/p>\n<p>\/\/ Set the layout manager<br \/>\nval layoutManager = LinearLayoutManager(this)<br \/>\nrecyclerView.layoutManager = layoutManager<\/p>\n<p>\/\/ Create an adapter<br \/>\nval adapter = MyAdapter(myDataSet)<br \/>\nrecyclerView.adapter = adapter<\/p>\n<p>\/\/ Add the RecyclerView to the layout<br \/>\nval parentLayout = findViewById<ConstraintLayout>(R.id.parent_layout)<br \/>\nparentLayout.addView(recyclerView) <\/p>\n<p><\/p>\n<div class=\"entry-content\" itemprop=\"text\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-1088640234840270\" crossorigin=\"anonymous\"><\/script><br \/>\n<script><\/p>\n<p><\/script><\/p>\n<p><\/p>\n<div id=\"answer-60111108\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"60111108\" data-parentid=\"60105586\" data-score=\"1\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<p>First You will need to create a layout for how a single row in your list will look(considering we are creating horizontal listing)<\/p>\n<p>navigate to res &gt; layout folder in your project, in layout folder create a Layout Resource File (fancy name, but it\u2019s just a XML file)<\/p>\n<p><strong>for example:-<\/strong><\/p>\n<p><strong>layout_demo_item.xml<\/strong><\/p>\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:layout_margin=\"8dp\"&gt;\n\n\n    &lt;ImageView\n        android:id=\"@+id\/a_image\"\n        android:layout_width=\"80dp\"\n        android:layout_height=\"80dp\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" \/&gt;\n\n    &lt;TextView\n        android:id=\"@+id\/text_title\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginStart=\"20dp\"\n        android:layout_marginEnd=\"20dp\"\n        android:textSize=\"18sp\"\n        app:layout_constraintBottom_toBottomOf=\"@+id\/a_image\"\n        app:layout_constraintStart_toEndOf=\"@+id\/a_image\"\n        app:layout_constraintTop_toTopOf=\"@+id\/a_image\" \/&gt;\n\n\n    &lt;TextView\n        android:id=\"@+id\/text_random\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginStart=\"20dp\"\n        android:layout_marginEnd=\"20dp\"\n        android:textSize=\"18sp\"\n        app:layout_constraintBottom_toBottomOf=\"@+id\/text_title\"\n        app:layout_constraintStart_toEndOf=\"@+id\/text_title\"\n        app:layout_constraintTop_toTopOf=\"@+id\/text_title\" \/&gt;\n\n&lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;\n<\/code><\/pre>\n<p>Second you need an Adapter.<\/p>\n<p>An Adapter will take a list\/array of data from you, render number of rows based on size of list and assign the data to each row based on position on list<\/p>\n<p><strong>for example:-<\/strong> <\/p>\n<p>You have an array of 6 names, then the adapter will create 6 identical row based on <code>layout_demo_item.xml<\/code> and assign data like 0th position data in array will be assigned to first element of list<\/p>\n<p><strong>MyAdapter.kt<\/strong><\/p>\n<pre><code>    class MyAdapter(var dataList: MutableList&lt;DataModelObject&gt;) : RecyclerView.Adapter&lt;MyAdapter.MyViewHolder&gt;() {\n\n\n        \/\/ inflating a layout in simple word is way of using a xml layout inside a class.\n        \/\/ if you look this is the same thing that your fragment doing inside onCreateView and storing that into \"root\" variable, we just did that in \"view\"\n        \/\/ we passed \"view\" to MyViewHolder and returned an object of MyViewHolder class(this object actually a single row without data)\n        override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {\n\n            val view = LayoutInflater.from(parent.context).inflate(R.layout.layout_demo_item, parent, false)\n\n            return MyViewHolder(view)\n        }\n\n\n        \/\/the returned object of MyViewHolder class will come here and also with the position on which it gonna show,\n        \/\/ now based on this position we can get the value from our list and finally set it to the corresponding view that we have here in variable \"holder\"\n        override fun onBindViewHolder(holder: MyViewHolder, position: Int) {\n\n            holder.textView.text = dataList.get(position).title\n            holder.textViewRandom.text = dataList.get(position).randomText\n\n            \/\/hardcoding the image, just for simplicity, you can set this also from data list same as above\n            holder.aImage.setImageResource(R.mipmap.ic_launcher)\n\n\n   \/\/here is the image setup by using glide\n \/\/Glide.with(holder.aImage.context).load(dataList.get(position).image).into(holder.aImage)\n\n        }\n\n        \/\/ this method telling adapter to how many total rows will be rendered based on count, so we returning the size of list that we passing\n        override fun getItemCount(): Int {\n            return dataList.size\n        }\n\n\n        \/\/ while creating the object in onCreateViewHolder, we received \"view\" here, and as you can see in your fragment,\n        \/\/ we can do find views by id on it same as we doing in fragment\n        \/\/ so your MyViewHolder now hold the reference of the actual views, on which you will set data\n        class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {\n\n\n            var textView: TextView\n            var textViewRandom: TextView\n            var aImage: ImageView\n\n\n            init {\n\n                textViewRandom = itemView.findViewById(R.id.text_random)\n                textView = itemView.findViewById(R.id.text_title)\n                aImage = itemView.findViewById(R.id.a_image)\n\n            }\n\n        }\n    }\n<\/code><\/pre>\n<p>here is the data class that we using as our model class(same as a <code>POJO<\/code> class in <code>Java<\/code> but it\u2019s just in <code>Kotlin<\/code>) <\/p>\n<pre><code>  data class DataModelObject(var randomText:String,var title :String) {\n    }\n<\/code><\/pre>\n<p>We have all things set to create a <code>recyclerView<\/code>, so now we will define <code>recyclerView<\/code> in Fragment like<\/p>\n<p><strong>fragment_home.xml<\/strong><\/p>\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;androidx.constraintlayout.widget.ConstraintLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    xmlns:app=\"http:\/\/schemas.android.com\/apk\/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"&gt;\n\n    &lt;TextView\n        android:id=\"@+id\/text_home\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:layout_marginStart=\"8dp\"\n        android:layout_marginTop=\"8dp\"\n        android:layout_marginEnd=\"8dp\"\n        android:textAlignment=\"center\"\n        android:textSize=\"20sp\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\" \/&gt;\n\n\n    &lt;androidx.recyclerview.widget.RecyclerView\n        android:id=\"@+id\/recycler_view_home\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"0dp\"\n        app:layout_constraintBottom_toBottomOf=\"parent\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toBottomOf=\"@+id\/text_home\" \/&gt;\n\n&lt;\/androidx.constraintlayout.widget.ConstraintLayout&gt;\n<\/code><\/pre>\n<p>Finally Inside kotlin class setting up a <code>recyclerView<\/code><\/p>\n<p><strong>HomeFragment.kt<\/strong><\/p>\n<p>(i\u2019m not including the irrelevant methods and variable that you have in this fragment, please consider them)<\/p>\n<pre><code>class HomeFragment : Fragment() {\n\n    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,\n                              savedInstanceState: Bundle?): View? {\n\n\n\n        val root = inflater.inflate(R.layout.fragment_home, container, false)\n\n        val textView: TextView = root.findViewById(R.id.text_home)\n        val recyclerView: RecyclerView = root.findViewById(R.id.recycler_view_home)\n\n        callAPIDemo(textView)\n\n        setUpRecyclerView(recyclerView);\n\n\n        return root\n    }\n\n    private fun setUpRecyclerView(recyclerView: RecyclerView) {\n\n        \/\/ first our data list that can come from API\/Database\n        \/\/ for now i'm just manually creating the list in getDummyData()\n        val list: MutableList&lt;DataModelObject&gt; = getDummyData()\n\n        \/\/ created an adapter object by passing the list object\n        var myAdapter = MyAdapter(list)\n\n        \/\/it's a layoutManager, that we use to tell recyclerview in which fashion  we want to show list,\n        \/\/ default is vertical even if you don't pass it and just pass the activity , and we don't want to reversing it so false\n        \/\/ by customizing it you can create Grids,vertical and horizontal lists, even card swipe like tinder\n        val linearLayoutManager = LinearLayoutManager(activity,LinearLayoutManager.VERTICAL,false)\n\n\n\n\n        \/\/ just set the above layout manager on RecyclerView\n        recyclerView.layoutManager = linearLayoutManager\n\n        \/\/and give it a adapter for data\n        recyclerView.adapter = myAdapter\n\n\n    }\n\n\n\n    private fun getDummyData(): MutableList&lt;DataModelObject&gt; {\n\n        val list: MutableList&lt;DataModelObject&gt; = mutableListOf(\n\n                DataModelObject(\"dfgdfg\", \"title 1\"),\n                DataModelObject(\"tyuityui\", \"title 2\"),\n                DataModelObject(\"yuti\", \"title 3\"),\n                DataModelObject(\"uY9NOrc-=s180-rw\", \"title 4\"),\n                DataModelObject(\"logo_color_272x92dp.png\", \"title 5\"),\n                DataModelObject(\"NOVtP26EKH\", \"title 6\"),\n                DataModelObject(\"googlelogo_color\", \"title 7\"),\n                DataModelObject(\"sNOVtP26EKHePkwBg-PkuY9NOrc-\", \"title 8\")\n\n        )\n\n        return list\n\n    }\n\n}\n<\/code><\/pre>\n<\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p> <span class=\"d-none\" itemprop=\"commentCount\">12<\/span> <\/p>\n<\/div>\n<\/div>\n<p>solved How to use RecyclerView in kotlin <\/p>\n<p><script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-1088640234840270\" crossorigin=\"anonymous\"><\/script><br \/>\n<script><\/p>\n<p><\/script><\/div>\n<p>[ad_2]<\/p>\n<h1>Solved: How to Use RecyclerView in Kotlin<\/h1>\n<p>RecyclerView is a powerful tool for displaying large amounts of data in a list format. It is a part of the Android Jetpack library and is a more advanced and flexible version of ListView. It is used to display large sets of data in a list format, and is often used in conjunction with other Android components such as ViewPager and CardView. In this article, we will discuss how to use RecyclerView in Kotlin.<\/p>\n<h2>Step 1: Add the Dependency<\/h2>\n<p>The first step is to add the RecyclerView dependency to your project. To do this, open your app&#8217;s build.gradle file and add the following line:<\/p>\n<pre><code>implementation 'androidx.recyclerview:recyclerview:1.1.0'<\/code><\/pre>\n<h2>Step 2: Create the Layout<\/h2>\n<p>Next, create the layout for the RecyclerView. This layout will contain the RecyclerView and any other views you want to include. For example, you may want to include a TextView for displaying the title of the list, or a Button for adding new items to the list. Here is an example of a simple layout for a RecyclerView:<\/p>\n<pre><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\n&lt;LinearLayout xmlns:android=\"http:\/\/schemas.android.com\/apk\/res\/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:orientation=\"vertical\"&gt;\n\n    &lt;TextView\n        android:id=\"@+id\/title\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"My List\" \/&gt;\n\n    &lt;androidx.recyclerview.widget.RecyclerView\n        android:id=\"@+id\/recycler_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\" \/&gt;\n\n&lt;\/LinearLayout&gt;<\/code><\/pre>\n<h2>Step 3: Create the Adapter<\/h2>\n<p>The next step is to create the adapter for the RecyclerView. The adapter is responsible for binding the data to the views in the list. To create the adapter, create a new class that extends RecyclerView.Adapter. Here is an example of a simple adapter for a RecyclerView:<\/p>\n<pre><code>class MyAdapter(private val items: List&lt;String&gt;) : RecyclerView.Adapter&lt;MyAdapter.ViewHolder&gt;() {\n\n    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {\n        val view = LayoutInflater.from(parent.context).inflate(R.layout.item_list, parent, false)\n        return ViewHolder(view)\n    }\n\n    override fun onBindViewHolder(holder: ViewHolder, position: Int) {\n        holder.textView.text = items[position]\n    }\n\n    override fun getItemCount(): Int {\n        return items.size\n    }\n\n    class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {\n        val textView: TextView = itemView.findViewById(R.id.text_view)\n    }\n}<\/code><\/pre>\n<h2>Step 4: Set the Adapter<\/h2>\n<p>The final step is to set the adapter for the RecyclerView. To do this, get a reference to the RecyclerView in your Activity or Fragment and set the adapter:<\/p>\n<pre><code>val recyclerView = findViewById&lt;RecyclerView&gt;(R.id.recycler_view)\nval adapter = MyAdapter(items)\nrecyclerView.adapter = adapter<\/code><\/pre>\n<p>And that&#8217;s it! You have now successfully implemented a RecyclerView in Kotlin.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction [ad_1] RecyclerView is a powerful tool for displaying large amounts of data in a user-friendly way. It is a part of the Android Jetpack library and is used to display large datasets in a list or grid format. It is an efficient way to display data and can be used with Kotlin to create &#8230; <a title=\"[Solved] How to use RecyclerView in kotlin\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/\" aria-label=\"More on [Solved] How to use RecyclerView in kotlin\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[452,600],"class_list":["post-328","post","type-post","status-publish","format-standard","hentry","category-solved","tag-android","tag-kotlin"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] How to use RecyclerView in kotlin - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] How to use RecyclerView in kotlin - JassWeb\" \/>\n<meta property=\"og:description\" content=\"Introduction [ad_1] RecyclerView is a powerful tool for displaying large amounts of data in a user-friendly way. It is a part of the Android Jetpack library and is used to display large datasets in a list or grid format. It is an efficient way to display data and can be used with Kotlin to create ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-01T10:23:36+00:00\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] How to use RecyclerView in kotlin\",\"datePublished\":\"2022-11-01T10:23:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/\"},\"wordCount\":648,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"keywords\":[\"android\",\"kotlin\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/\",\"name\":\"[Solved] How to use RecyclerView in kotlin - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"datePublished\":\"2022-11-01T10:23:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] How to use RecyclerView in kotlin\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775193939\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775193939\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] How to use RecyclerView in kotlin - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] How to use RecyclerView in kotlin - JassWeb","og_description":"Introduction [ad_1] RecyclerView is a powerful tool for displaying large amounts of data in a user-friendly way. It is a part of the Android Jetpack library and is used to display large datasets in a list or grid format. It is an efficient way to display data and can be used with Kotlin to create ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/","og_site_name":"JassWeb","article_published_time":"2022-11-01T10:23:36+00:00","author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] How to use RecyclerView in kotlin","datePublished":"2022-11-01T10:23:36+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/"},"wordCount":648,"commentCount":0,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"keywords":["android","kotlin"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/","url":"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/","name":"[Solved] How to use RecyclerView in kotlin - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"datePublished":"2022-11-01T10:23:36+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-how-to-use-recyclerview-in-kotlin-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] How to use RecyclerView in kotlin"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775193939","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775193939","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=328"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/328\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}