[{"data":1,"prerenderedAt":212},["ShallowReactive",2],{"public-settings":3,"footer-custom-pages":18,"post-android-recycler-view-tutorial":31,"article-code-1x53x2p":211},{"site_title":4,"tagline":5,"site_url":6,"footer_text":5,"social_twitter":7,"social_github":7,"social_youtube":7,"social_linkedin":7,"social_mastodon":7,"og_image":8,"comments_enabled":9,"ads_mode":10,"ads_publisher_id":11,"ads_adtest":12,"ads_in_article_enabled":9,"ads_in_article_slot":13,"ads_in_article_paragraph":14,"ads_end_of_post_enabled":9,"ads_end_of_post_slot":13,"ads_feed_enabled":9,"ads_feed_slot":13,"ads_feed_every":15,"ads_sidebar_enabled":9,"ads_sidebar_slot":13,"ads_consent_enabled":9,"clarity_enabled":12,"clarity_project_id":16,"seo_enabled":9,"llms_enabled":9,"verification_google":7,"verification_bing":7,"seo_home_title":7,"seo_description":7,"indexnow_key":7,"performance_lcp_preload":9,"pwa_enabled":9,"bookmarks_enabled":9,"comments_moderation":9,"home_carousel_featured":9,"home_carousel_latest":9,"home_carousel_latest_mode":17,"home_carousel_series":9,"home_carousel_topics":9},"Android Learner","Practical Android development, explained clearly.","https:\u002F\u002Fwww.androidlearner.com","","\u002Fmedia\u002Fseed\u002Fcover-llm.webp","1","live","ca-pub-3394535770235553","0","9901451769","2","3","jmrmm96ef6","latest",[19,26],{"id":20,"title":21,"slug":22,"show_in_footer":23,"sort_order":24,"updated_at":25},1,"Terms & Conditions","terms",true,10,"2026-11-28 13:13:48",{"id":27,"title":28,"slug":29,"show_in_footer":23,"sort_order":30,"updated_at":25},2,"Privacy Policy","privacy",20,{"post":32,"comments":210},{"id":33,"title":34,"slug":35,"path":36,"excerpt":37,"cover_image":38,"cover_media_id":39,"status":40,"publish_at":41,"reading_time":42,"seo_title":34,"seo_description":37,"og_image":38,"canonical_url":43,"noindex":44,"featured":44,"faq":45,"howto":46,"review_note":46,"submitted_at":46,"reviewed_at":46,"category":47,"series":46,"tags":52,"author":60,"created_at":41,"updated_at":63,"body_md":64,"body_html":65,"related":66},11,"Android Recycler View Tutorial","android-recycler-view-tutorial","\u002F2017\u002F07\u002Fandroid-recycler-view-tutorial.html","In Android there is the need when you need to display a list of data or simply data that get generated at run-time. Rather than creating your own layout inflator. Android provide Recycler View, there is also a listview which was provided to show data. After after many experiments with Recycler...","\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-01.webp",31,"published","2017-07-21 19:13:00",3,"https:\u002F\u002Fwww.androidlearner.com\u002F2017\u002F07\u002Fandroid-recycler-view-tutorial.html",false,[],null,{"id":48,"name":49,"slug":50,"description":51},6,"Android Development","android-development","Tutorials and guides imported from the original Android Learner blog.",[53,57],{"id":54,"name":55,"slug":56,"description":46},28,"Android","android",{"id":39,"name":58,"slug":59,"description":46},"Recycler View","recycler-view",{"id":20,"name":4,"username":61,"avatar":46,"profile_path":62},"superadmin","\u002Fu\u002Fsuperadmin","2017-11-26 09:21:23","[CodeProject](https:\u002F\u002Fwww.codeproject.com\u002F)\n\nIn Android there is the need when you need to display a list of data or simply data that get generated at run-time. Rather than creating your own layout inflator. Android provide Recycler View, there is also a listview which was provided to show data.\nAfter after many experiments with Recycler View here is the tutorial for it. Hope it will be use full to someone.I assume if you are reading this then you know how to add activity in the android studio.\nI have divided the article into several parts. Here is the First part.\nPart 2 : \u003Chttp:\u002F\u002Fwww.androidlearner.com\u002F2017\u002F11\u002Fandroid-recycler-view-tutorial-part-2.html>\nHere is the video of it :\n\n### # First Create an Android Project.\n\n### #Compiling the required library\n\nOpen your build.gradle file for (module:app) level\nadd line **compile 'com.android.support:recyclerview-v7:25.3.1'**  in the **dependencies** section.\nthis will download recycler view dependencies in the project.\n\n```groovy\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {\n        exclude group: 'com.android.support', module: 'support-annotations'\n    })\n\n    compile 'com.android.support:appcompat-v7:25.3.1'\n    compile 'com.android.support.constraint:constraint-layout:1.0.2'\n    \u002F\u002FRecycler view library -- its version should be similar as appcompact.\n    \u002F\u002F It can also be used as\n    \u002F\u002Fcompile 'com.android.support:recyclerview-v7:25.+'\n    compile 'com.android.support:recyclerview-v7:25.3.1'\n\n    testCompile 'junit:junit:4.12'\n}\n```\n\n### # Add the Recycler view to the layout.\n\nOpen your layout file and add the View.\n\n```xml\n\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n\u003CRelativeLayout xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\n    xmlns:app=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres-auto\"\n    xmlns:tools=\"http:\u002F\u002Fschemas.android.com\u002Ftools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\"skd.app.androidfeatures.sRecylerView.RecylerActivity\">\n\n    \u003C!-- Recycler view -->\n    \u003Candroid.support.v7.widget.RecyclerView\n        android:id=\"@+id\u002Fmy_recycler_view\"\n        android:scrollbars=\"vertical\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\u002F>\n\n\u003C\u002FRelativeLayout>\n```\n\n### # Initializing the Recycler View in your activity class.\n\nRecycler view requires 3 components to set it up.\n\n- The **Recycler view** widget from the layout.\n- The **Data Adapter** for the view , This contain the data which need to be shown\n- The **LayoutManager** , it defines how data is shown in the Layout.\n\nNow open your Activity Class which corresponds to the layout which contain the recycler view.\nand set up your Recycler View.\n\n```java\nimport android.support.v7.app.AppCompatActivity;\nimport android.os.Bundle;\nimport android.support.v7.widget.LinearLayoutManager;\nimport android.support.v7.widget.RecyclerView;\n\nimport skd.app.androidfeatures.R;\n\npublic class RecylerActivity extends AppCompatActivity {\n\n    \u002F\u002FBelow are the componets which are required by the Recycler view\n    RecyclerView recyclerView; \u002F\u002Fthis will hold the recycler view from the layout\n    RecyclerView.Adapter   mAdapter; \u002F\u002Fthis will hold the adapter for the recycler view\n    RecyclerView.LayoutManager mLayoutmanager; \u002F\u002Fholds the layout manager\n\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n\n        setContentView(R.layout.activity_recyler); \u002F\u002Flayout which contain the recycler view\n\n        \u002F\u002FFind the Recycler view\n        recyclerView = (RecyclerView)findViewById(R.id.my_recycler_view); \u002F\u002Fgot the recycler view from the layout\n\n        \u002F\u002Fset the layout manager for the recycler view\n        \u002F\u002Fstandard layout managers( LinearLayoutManager or GridLayoutManager) can be used, or implement your own.\n        \u002F\u002FLayout Manager tells how the item are shown in your Recycler View\n        mLayoutmanager = new LinearLayoutManager(this);\n        recyclerView.setLayoutManager(mLayoutmanager);\n\n        \u002F\u002Fset the data adapter\n        \u002F\u002FAdapter contain the Data Which need to be shown in the view\n        mAdapter = new RvDataAdpt();\n        recyclerView.setAdapter(mAdapter);\n    }\n}\n```\n\n### #Recycler View Item\n\nNow we need to create and recycler item , i.e the layout which can be shown by the recycler view.\nAdd layout **recycler_item.xml**\n\n[![Screenshot 4](\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-01.webp)](\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-01.webp)\n\n```xml\n\u003C?xml version=\"1.0\" encoding=\"utf-8\"?>\n\u003CLinearLayout xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:layout_marginTop=\"10dp\"\n    android:orientation=\"vertical\">\n\n    \u003CTextView\n        android:id=\"@+id\u002FtextView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:text=\"Hii \"\n        android:textSize=\"30sp\" \u002F>\n\u003C\u002FLinearLayout>\n```\n\n### # The Data Adapter\n\nThe data Adapter is the component which feeds to the recycler view. In the post I will describe how to set up the basic adapter class to able to show the view. listening events from the view will be decribed in a later post :).\nAs per Android doc your adapter class must extent [RecyclerView.Adapter](https:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv7\u002Fwidget\u002FRecyclerView.Adapter.html) class from the support library.\n\n```java\nimport android.support.v7.widget.RecyclerView;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport skd.app.androidfeatures.R;\n\n\u002F**\n * THis class will be the data adapter for the recycler view\n * This class must exxtend the Recycler view adapter.\n *\u002F\npublic class RvDataAdpt extends RecyclerView.Adapter {\n    @Override\n    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n\n        return null;\n    }\n\n    @Override\n    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {\n\n    }\n\n    @Override\n    public int getItemCount() {\n        return 0;\n    }\n}\n```\n\nThese methods are need overridden by the base class.\n**onCreateViewHolder** : This method used to construct the view holder and set the view it uses\n to display its contents. Typically, it would set the view by inflating an XML layout file.\n**onBindViewHolder** : Called by RecyclerView to display the data at the specified position. This method should update the contents of the itemView to reflect the item at the given position.\n**getItemCount** : Returns the total number of items in the data set held by the adapter.\n\nFor more info visit [Recycler Adapter](https:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv7\u002Fwidget\u002FRecyclerView.Adapter.html)\n\nAt this point if you run the application. Recycler view will be visible however with no item.\n\nNow lets try to display our item layout in the recycler.\n\nTo display the item in the recycler view we need to inflate our item in the **onCreateViewHolder**method however. However this method return data of **[RecyclerView.ViewHolder](https:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv7\u002Fwidget\u002FRecyclerView.ViewHolder.html)** , so we first need to convert or return our view as **ViewHolder** type. By creating instance of ViewHolder Class.\n\nTo set the count of the item displayed. getItemCount should return value greater than 0.\n\n```java\nimport android.support.v7.widget.RecyclerView;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport skd.app.androidfeatures.R;\n\n\u002F**\n * THis class will be the data adapter for the recycler view\n * This class must exxtend the Recycler view adapter.\n *\u002F\npublic class RvDataAdpt extends RecyclerView.Adapter {\n    @Override\n    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n\n        \u002F\u002Flets populate our recyler view with the item created;\n        \u002F\u002Fget the view from the layout inflator\n        \u002F\u002F  third parameter is set to false to prevent viewgroup to attach to root\n        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_item,parent,false);\n\n        \u002F\u002F as this method need to return the viewHolder type\n        \u002F\u002F need to convert our view to the view holder\n        RecyclerView.ViewHolder viewHolder = new RecyclerView.ViewHolder(view) {\n            @Override\n            public String toString() {\n                return super.toString();\n            }\n        };\n        return viewHolder;\n    }\n\n    @Override\n    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {\n\n    }\n\n    @Override\n    public int getItemCount() {\n  \u002F\u002Fthis defined how many items need to be displayed\n        return 3000; \u002F\u002F to display the 3000 items\n    }\n}\n```\n\nNow After compiling and running the application you will get something like this.\n\n[![Screenshot 1](\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-02.webp)](\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-02.webp)\n\nIn the next post I will describe how to use Recycler view with proper items ,with data model and listing to the events of the items.\nSource Code : -\u003Chttps:\u002F\u002Fgithub.com\u002Fsapandang\u002FAndroidFeatures>\n","\u003Cp>\u003Ca href=\"https:\u002F\u002Fwww.codeproject.com\u002F\">CodeProject\u003C\u002Fa>\u003C\u002Fp>\n\u003Cp>In Android there is the need when you need to display a list of data or simply data that get generated at run-time. Rather than creating your own layout inflator. Android provide Recycler View, there is also a listview which was provided to show data.\nAfter after many experiments with Recycler View here is the tutorial for it. Hope it will be use full to someone.I assume if you are reading this then you know how to add activity in the android studio.\nI have divided the article into several parts. Here is the First part.\nPart 2 : \u003Ca href=\"http:\u002F\u002Fwww.androidlearner.com\u002F2017\u002F11\u002Fandroid-recycler-view-tutorial-part-2.html\">http:\u002F\u002Fwww.androidlearner.com\u002F2017\u002F11\u002Fandroid-recycler-view-tutorial-part-2.html\u003C\u002Fa>\nHere is the video of it :\u003C\u002Fp>\n\u003Ch3 id=\"first-create-an-android-project\"># First Create an Android Project.\u003C\u002Fh3>\n\u003Ch3 id=\"compiling-the-required-library\">#Compiling the required library\u003C\u002Fh3>\n\u003Cp>Open your build.gradle file for (module:app) level\nadd line \u003Cstrong>compile 'com.android.support:recyclerview-v7:25.3.1'\u003C\u002Fstrong>  in the \u003Cstrong>dependencies\u003C\u002Fstrong> section.\nthis will download recycler view dependencies in the project.\u003C\u002Fp>\n\u003Cpre class=\"code-block\" data-lang=\"groovy\">\u003Ccode class=\"language-groovy\">dependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {\n        exclude group: 'com.android.support', module: 'support-annotations'\n    })\n\n    compile 'com.android.support:appcompat-v7:25.3.1'\n    compile 'com.android.support.constraint:constraint-layout:1.0.2'\n    \u002F\u002FRecycler view library -- its version should be similar as appcompact.\n    \u002F\u002F It can also be used as\n    \u002F\u002Fcompile 'com.android.support:recyclerview-v7:25.+'\n    compile 'com.android.support:recyclerview-v7:25.3.1'\n\n    testCompile 'junit:junit:4.12'\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3 id=\"add-the-recycler-view-to-the-layout\"># Add the Recycler view to the layout.\u003C\u002Fh3>\n\u003Cp>Open your layout file and add the View.\u003C\u002Fp>\n\u003Cpre class=\"code-block\" data-lang=\"xml\">\u003Ccode class=\"language-xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\n&lt;RelativeLayout xmlns:android=&quot;http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid&quot;\n    xmlns:app=&quot;http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres-auto&quot;\n    xmlns:tools=&quot;http:\u002F\u002Fschemas.android.com\u002Ftools&quot;\n    android:layout_width=&quot;match_parent&quot;\n    android:layout_height=&quot;match_parent&quot;\n    tools:context=&quot;skd.app.androidfeatures.sRecylerView.RecylerActivity&quot;&gt;\n\n    &lt;!-- Recycler view --&gt;\n    &lt;android.support.v7.widget.RecyclerView\n        android:id=&quot;@+id\u002Fmy_recycler_view&quot;\n        android:scrollbars=&quot;vertical&quot;\n        android:layout_width=&quot;match_parent&quot;\n        android:layout_height=&quot;match_parent&quot;\u002F&gt;\n\n&lt;\u002FRelativeLayout&gt;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3 id=\"initializing-the-recycler-view-in-your-activity-class\"># Initializing the Recycler View in your activity class.\u003C\u002Fh3>\n\u003Cp>Recycler view requires 3 components to set it up.\u003C\u002Fp>\n\u003Cul>\n\u003Cli>The \u003Cstrong>Recycler view\u003C\u002Fstrong> widget from the layout.\u003C\u002Fli>\n\u003Cli>The \u003Cstrong>Data Adapter\u003C\u002Fstrong> for the view , This contain the data which need to be shown\u003C\u002Fli>\n\u003Cli>The \u003Cstrong>LayoutManager\u003C\u002Fstrong> , it defines how data is shown in the Layout.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Now open your Activity Class which corresponds to the layout which contain the recycler view.\nand set up your Recycler View.\u003C\u002Fp>\n\u003Cpre class=\"code-block\" data-lang=\"java\">\u003Ccode class=\"language-java\">import android.support.v7.app.AppCompatActivity;\nimport android.os.Bundle;\nimport android.support.v7.widget.LinearLayoutManager;\nimport android.support.v7.widget.RecyclerView;\n\nimport skd.app.androidfeatures.R;\n\npublic class RecylerActivity extends AppCompatActivity {\n\n    \u002F\u002FBelow are the componets which are required by the Recycler view\n    RecyclerView recyclerView; \u002F\u002Fthis will hold the recycler view from the layout\n    RecyclerView.Adapter   mAdapter; \u002F\u002Fthis will hold the adapter for the recycler view\n    RecyclerView.LayoutManager mLayoutmanager; \u002F\u002Fholds the layout manager\n\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n\n        setContentView(R.layout.activity_recyler); \u002F\u002Flayout which contain the recycler view\n\n        \u002F\u002FFind the Recycler view\n        recyclerView = (RecyclerView)findViewById(R.id.my_recycler_view); \u002F\u002Fgot the recycler view from the layout\n\n        \u002F\u002Fset the layout manager for the recycler view\n        \u002F\u002Fstandard layout managers( LinearLayoutManager or GridLayoutManager) can be used, or implement your own.\n        \u002F\u002FLayout Manager tells how the item are shown in your Recycler View\n        mLayoutmanager = new LinearLayoutManager(this);\n        recyclerView.setLayoutManager(mLayoutmanager);\n\n        \u002F\u002Fset the data adapter\n        \u002F\u002FAdapter contain the Data Which need to be shown in the view\n        mAdapter = new RvDataAdpt();\n        recyclerView.setAdapter(mAdapter);\n    }\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3 id=\"recycler-view-item\">#Recycler View Item\u003C\u002Fh3>\n\u003Cp>Now we need to create and recycler item , i.e the layout which can be shown by the recycler view.\nAdd layout \u003Cstrong>recycler_item.xml\u003C\u002Fstrong>\u003C\u002Fp>\n\u003Cp>\u003Ca href=\"\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-01.webp\">\u003Cimg src=\"\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-01.webp\" alt=\"Screenshot 4\" \u002F>\u003C\u002Fa>\u003C\u002Fp>\n\u003Cpre class=\"code-block\" data-lang=\"xml\">\u003Ccode class=\"language-xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\n&lt;LinearLayout xmlns:android=&quot;http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid&quot;\n    android:layout_width=&quot;match_parent&quot;\n    android:layout_height=&quot;wrap_content&quot;\n    android:layout_marginTop=&quot;10dp&quot;\n    android:orientation=&quot;vertical&quot;&gt;\n\n    &lt;TextView\n        android:id=&quot;@+id\u002FtextView&quot;\n        android:layout_width=&quot;match_parent&quot;\n        android:layout_height=&quot;wrap_content&quot;\n        android:text=&quot;Hii &quot;\n        android:textSize=&quot;30sp&quot; \u002F&gt;\n&lt;\u002FLinearLayout&gt;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch3 id=\"the-data-adapter\"># The Data Adapter\u003C\u002Fh3>\n\u003Cp>The data Adapter is the component which feeds to the recycler view. In the post I will describe how to set up the basic adapter class to able to show the view. listening events from the view will be decribed in a later post :).\nAs per Android doc your adapter class must extent \u003Ca href=\"https:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv7\u002Fwidget\u002FRecyclerView.Adapter.html\">RecyclerView.Adapter\u003C\u002Fa> class from the support library.\u003C\u002Fp>\n\u003Cpre class=\"code-block\" data-lang=\"java\">\u003Ccode class=\"language-java\">import android.support.v7.widget.RecyclerView;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport skd.app.androidfeatures.R;\n\n\u002F**\n * THis class will be the data adapter for the recycler view\n * This class must exxtend the Recycler view adapter.\n *\u002F\npublic class RvDataAdpt extends RecyclerView.Adapter {\n    @Override\n    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n\n        return null;\n    }\n\n    @Override\n    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {\n\n    }\n\n    @Override\n    public int getItemCount() {\n        return 0;\n    }\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>These methods are need overridden by the base class.\n\u003Cstrong>onCreateViewHolder\u003C\u002Fstrong> : This method used to construct the view holder and set the view it uses\nto display its contents. Typically, it would set the view by inflating an XML layout file.\n\u003Cstrong>onBindViewHolder\u003C\u002Fstrong> : Called by RecyclerView to display the data at the specified position. This method should update the contents of the itemView to reflect the item at the given position.\n\u003Cstrong>getItemCount\u003C\u002Fstrong> : Returns the total number of items in the data set held by the adapter.\u003C\u002Fp>\n\u003Cp>For more info visit \u003Ca href=\"https:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv7\u002Fwidget\u002FRecyclerView.Adapter.html\">Recycler Adapter\u003C\u002Fa>\u003C\u002Fp>\n\u003Cp>At this point if you run the application. Recycler view will be visible however with no item.\u003C\u002Fp>\n\u003Cp>Now lets try to display our item layout in the recycler.\u003C\u002Fp>\n\u003Cp>To display the item in the recycler view we need to inflate our item in the \u003Cstrong>onCreateViewHolder\u003C\u002Fstrong>method however. However this method return data of \u003Cstrong>\u003Ca href=\"https:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv7\u002Fwidget\u002FRecyclerView.ViewHolder.html\">RecyclerView.ViewHolder\u003C\u002Fa>\u003C\u002Fstrong> , so we first need to convert or return our view as \u003Cstrong>ViewHolder\u003C\u002Fstrong> type. By creating instance of ViewHolder Class.\u003C\u002Fp>\n\u003Cp>To set the count of the item displayed. getItemCount should return value greater than 0.\u003C\u002Fp>\n\u003Cpre class=\"code-block\" data-lang=\"java\">\u003Ccode class=\"language-java\">import android.support.v7.widget.RecyclerView;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\n\nimport skd.app.androidfeatures.R;\n\n\u002F**\n * THis class will be the data adapter for the recycler view\n * This class must exxtend the Recycler view adapter.\n *\u002F\npublic class RvDataAdpt extends RecyclerView.Adapter {\n    @Override\n    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n\n        \u002F\u002Flets populate our recyler view with the item created;\n        \u002F\u002Fget the view from the layout inflator\n        \u002F\u002F  third parameter is set to false to prevent viewgroup to attach to root\n        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_item,parent,false);\n\n        \u002F\u002F as this method need to return the viewHolder type\n        \u002F\u002F need to convert our view to the view holder\n        RecyclerView.ViewHolder viewHolder = new RecyclerView.ViewHolder(view) {\n            @Override\n            public String toString() {\n                return super.toString();\n            }\n        };\n        return viewHolder;\n    }\n\n    @Override\n    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {\n\n    }\n\n    @Override\n    public int getItemCount() {\n  \u002F\u002Fthis defined how many items need to be displayed\n        return 3000; \u002F\u002F to display the 3000 items\n    }\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Now After compiling and running the application you will get something like this.\u003C\u002Fp>\n\u003Cp>\u003Ca href=\"\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-02.webp\">\u003Cimg src=\"\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-02.webp\" alt=\"Screenshot 1\" \u002F>\u003C\u002Fa>\u003C\u002Fp>\n\u003Cp>In the next post I will describe how to use Recycler view with proper items ,with data model and listing to the events of the items.\nSource Code : -\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fsapandang\u002FAndroidFeatures\">https:\u002F\u002Fgithub.com\u002Fsapandang\u002FAndroidFeatures\u003C\u002Fa>\u003C\u002Fp>\n",[67,107,150,181],{"id":68,"title":69,"slug":70,"path":71,"excerpt":72,"cover_image":73,"cover_media_id":74,"status":40,"publish_at":75,"reading_time":27,"seo_title":76,"seo_description":77,"og_image":73,"canonical_url":78,"noindex":44,"featured":44,"faq":79,"howto":46,"review_note":46,"submitted_at":46,"reviewed_at":46,"category":86,"series":46,"tags":90,"author":104,"created_at":105,"updated_at":106},23,"Android 17 AppFunctions & Android MCP: Exposing App Actions to Gemini","android-17-appfunctions-android-mcp-gemini","\u002Fposts\u002Fandroid-17-appfunctions-android-mcp-gemini","Android 17 expands AppFunctions so apps can expose structured actions to Gemini and Android MCP clients. Learn how to declare functions, validate inputs, and test locally.","\u002Fmedia\u002F2026\u002F11\u002F89e9aba2e88d1684.webp",65,"2026-11-28 15:45:00","Android 17 AppFunctions & Android MCP Guide","Learn how to expose structured in-app capabilities using Android 17 AppFunctions and Jetpack libraries for Gemini and Android MCP orchestration.","https:\u002F\u002Fwww.androidlearner.com\u002Fposts\u002Fandroid-17-appfunctions-android-mcp-gemini\u002F",[80,83],{"question":81,"answer":82},"Do AppFunctions replace deep links or App Actions?","No. Deep links still open specific screens from URLs or intents, while AppFunctions expose typed, callable capabilities that the system or an on-device assistant can invoke with structured parameters and receive a typed result.",{"question":84,"answer":85},"Can users or the OS restrict which AppFunctions run?","Yes. AppFunctions follow Android's permission and user-consent model, and sensitive actions should require explicit confirmation or foreground verification before mutating user data.",{"id":20,"name":87,"slug":88,"description":89},"On-device AI","on-device-ai","Running models on the phone, not the cloud.",[91,94,95,99,102],{"id":30,"name":92,"slug":93,"description":46},"AI Development","ai-development",{"id":54,"name":55,"slug":56,"description":46},{"id":96,"name":97,"slug":98,"description":46},35,"Android 17","android-17",{"id":42,"name":100,"slug":101,"description":46},"Gemini Nano","gemini-nano",{"id":103,"name":87,"slug":88,"description":46},51,{"id":20,"name":4,"username":61,"avatar":46,"profile_path":62},"2026-11-28 10:11:52","2026-11-28 10:15:23",{"id":108,"title":109,"slug":110,"path":111,"excerpt":112,"cover_image":113,"cover_media_id":114,"status":40,"publish_at":115,"reading_time":27,"seo_title":116,"seo_description":117,"og_image":113,"canonical_url":118,"noindex":44,"featured":44,"faq":119,"howto":46,"review_note":46,"submitted_at":46,"reviewed_at":46,"category":126,"series":46,"tags":131,"author":147,"created_at":148,"updated_at":149},27,"Jetpack AppState & Snapshot State Architecture: Beyond UI State","jetpack-appstate-snapshot-state-architecture","\u002Fposts\u002Fjetpack-appstate-snapshot-state-architecture","Compose's snapshot state system isn't just for UI. Learn how Jetpack AppState and snapshot-backed stores synchronize reactive state across screens, services, and widgets.","\u002Fmedia\u002F2026\u002F11\u002F3a2381e9f25fce93.webp",69,"2026-11-28 15:43:00","Jetpack AppState & Snapshot State Architecture in Android","Use Compose's snapshot state system and Jetpack AppState patterns to manage reactive state cleanly across ViewModels, background workers, and widgets.","https:\u002F\u002Fwww.androidlearner.com\u002Fposts\u002Fjetpack-appstate-snapshot-state-architecture\u002F",[120,123],{"question":121,"answer":122},"How is snapshot state different from MutableStateFlow?","Snapshot state tracks fine-grained property reads automatically without explicit combine\u002Fmap operators, and supports atomic multi-property transactions via Snapshot.withMutableSnapshot.",{"question":124,"answer":125},"Can snapshot state be used outside @Composable functions?","Yes. Compose Runtime's snapshot system has no Android View or UI dependency and can run in ViewModels, repositories, or background workers using snapshotFlow.",{"id":127,"name":128,"slug":129,"description":130},4,"Architecture","architecture","App architecture and data layers.",[132,133,135,139,143],{"id":54,"name":55,"slug":56,"description":46},{"id":134,"name":128,"slug":129,"description":46},48,{"id":136,"name":137,"slug":138,"description":46},24,"Jetpack","jetpack",{"id":140,"name":141,"slug":142,"description":46},18,"Jetpack Compose","jetpack-compose",{"id":144,"name":145,"slug":146,"description":46},5,"State hoisting","state-hoisting",{"id":20,"name":4,"username":61,"avatar":46,"profile_path":62},"2026-11-28 10:11:54","2026-11-28 10:14:38",{"id":151,"title":152,"slug":153,"path":154,"excerpt":155,"cover_image":156,"cover_media_id":157,"status":40,"publish_at":158,"reading_time":27,"seo_title":159,"seo_description":160,"og_image":156,"canonical_url":161,"noindex":44,"featured":44,"faq":162,"howto":46,"review_note":46,"submitted_at":46,"reviewed_at":46,"category":169,"series":46,"tags":170,"author":179,"created_at":180,"updated_at":158},25,"Android 17's Mandatory Adaptive-First & Large-Screen Resizability Rules","android-17-adaptive-first-large-screen-resizability","\u002Fposts\u002Fandroid-17-adaptive-first-large-screen-resizability","Android 17 enforces adaptive-first layouts and large-screen resizability. Here is how to audit orientation locks, adopt WindowSizeClass, and ship ListDetailPaneScaffold.","\u002Fmedia\u002F2026\u002F11\u002F2df599bf25a8e4e3.webp",67,"2026-11-28 10:15:06","Android 17 Adaptive-First & Resizability Requirements","Prepare your Android app for Android 17's mandatory large-screen resizability and adaptive-first layout rules using WindowSizeClass and Material 3 adaptive scaffolds.","https:\u002F\u002Fwww.androidlearner.com\u002Fposts\u002Fandroid-17-adaptive-first-large-screen-resizability\u002F",[163,166],{"question":164,"answer":165},"Can I still lock screenOrientation=portrait on tablets and foldables in Android 17?","Android 17 removes legacy opt-outs for resizability on large screens (smallest width >= 600dp), meaning the system ignores fixed portrait\u002Flandscape locks and non-resizable flags.",{"question":167,"answer":168},"What is the fastest way to make an existing Compose screen adaptive?","Read currentWindowAdaptiveInfo() from Material 3 Adaptive, avoid hardcoded dp widths, and use ListDetailPaneScaffold or SupportingPaneScaffold for two-pane tablet and desktop layouts.",{"id":127,"name":128,"slug":129,"description":130},[171,172,173,174,175],{"id":54,"name":55,"slug":56,"description":46},{"id":96,"name":97,"slug":98,"description":46},{"id":134,"name":128,"slug":129,"description":46},{"id":140,"name":141,"slug":142,"description":46},{"id":176,"name":177,"slug":178,"description":46},46,"Material 3","material-3",{"id":20,"name":4,"username":61,"avatar":46,"profile_path":62},"2026-11-28 10:11:53",{"id":136,"title":182,"slug":183,"path":184,"excerpt":185,"cover_image":186,"cover_media_id":187,"status":40,"publish_at":188,"reading_time":27,"seo_title":189,"seo_description":190,"og_image":186,"canonical_url":191,"noindex":44,"featured":44,"faq":192,"howto":46,"review_note":46,"submitted_at":46,"reviewed_at":46,"category":199,"series":46,"tags":201,"author":209,"created_at":180,"updated_at":188},"Google's \"Compose First\" Era: Migrating Legacy XML & RecyclerView Screens","compose-first-migrating-legacy-xml-recyclerview","\u002Fposts\u002Fcompose-first-migrating-legacy-xml-recyclerview","With android.widget Views, Fragments, and XML layout editors officially in maintenance mode, here is a practical, incremental playbook for migrating to Jetpack Compose.","\u002Fmedia\u002F2026\u002F11\u002F5f47e539df8d96b9.webp",66,"2026-11-28 10:14:54","Compose First Migration Guide: XML & RecyclerView to Compose","Step-by-step guide to migrating legacy Android XML layouts, Fragments, and RecyclerView adapters to Jetpack Compose without rewriting your entire app at once.","https:\u002F\u002Fwww.androidlearner.com\u002Fposts\u002Fcompose-first-migrating-legacy-xml-recyclerview\u002F",[193,196],{"question":194,"answer":195},"Do I have to rewrite my entire app to adopt Compose First?","No. You can embed Compose inside existing XML layouts with ComposeView, replace RecyclerView item types incrementally, and migrate Fragment navigation screen by screen.",{"question":197,"answer":198},"Are XML Views being removed from Android?","No, existing View APIs remain in the Android SDK for compatibility, but they are in maintenance mode—meaning critical bug fixes only, while all new UI capabilities ship in Jetpack Compose.",{"id":27,"name":141,"slug":142,"description":200},"Modern Android UI.",[202,203,204,207,208],{"id":54,"name":55,"slug":56,"description":46},{"id":134,"name":128,"slug":129,"description":46},{"id":127,"name":205,"slug":206,"description":46},"Compose","compose",{"id":140,"name":141,"slug":142,"description":46},{"id":39,"name":58,"slug":59,"description":46},{"id":20,"name":4,"username":61,"avatar":46,"profile_path":62},[],"\u003Cp>\u003Ca href=\"https:\u002F\u002Fwww.codeproject.com\u002F\">CodeProject\u003C\u002Fa>\u003C\u002Fp>\n\u003Cp>In Android there is the need when you need to display a list of data or simply data that get generated at run-time. Rather than creating your own layout inflator. Android provide Recycler View, there is also a listview which was provided to show data.\nAfter after many experiments with Recycler View here is the tutorial for it. Hope it will be use full to someone.I assume if you are reading this then you know how to add activity in the android studio.\nI have divided the article into several parts. Here is the First part.\nPart 2 : \u003Ca href=\"http:\u002F\u002Fwww.androidlearner.com\u002F2017\u002F11\u002Fandroid-recycler-view-tutorial-part-2.html\">http:\u002F\u002Fwww.androidlearner.com\u002F2017\u002F11\u002Fandroid-recycler-view-tutorial-part-2.html\u003C\u002Fa>\nHere is the video of it :\u003C\u002Fp>\n\u003Ch3 id=\"first-create-an-android-project\"># First Create an Android Project.\u003C\u002Fh3>\n\u003Ch3 id=\"compiling-the-required-library\">#Compiling the required library\u003C\u002Fh3>\n\u003Cp>Open your build.gradle file for (module:app) level\nadd line \u003Cstrong>compile 'com.android.support:recyclerview-v7:25.3.1'\u003C\u002Fstrong>  in the \u003Cstrong>dependencies\u003C\u002Fstrong> section.\nthis will download recycler view dependencies in the project.\u003C\u002Fp>\n\u003Cdiv class=\"code-block\" data-lang=\"groovy\">\u003Cdiv class=\"code-block__header\">\u003Cspan class=\"code-block__lang\">groovy\u003C\u002Fspan>\u003Cbutton type=\"button\" class=\"code-block__copy\" aria-label=\"Copy code\">Copy\u003C\u002Fbutton>\u003C\u002Fdiv>\u003Cdiv class=\"code-block__body\">\u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">dependencies {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    compile fileTree(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">dir\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'libs'\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">include\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: [\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'*.jar'\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">])\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    androidTestCompile(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'com.android.support.test.espresso:espresso-core:2.2.2'\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        exclude \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">group\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'com.android.support'\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">module\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'support-annotations'\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    })\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    compile \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'com.android.support:appcompat-v7:25.3.1'\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    compile \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'com.android.support.constraint:constraint-layout:1.0.2'\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">    \u002F\u002FRecycler view library -- its version should be similar as appcompact.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">    \u002F\u002F It can also be used as\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">    \u002F\u002Fcompile 'com.android.support:recyclerview-v7:25.+'\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    compile \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'com.android.support:recyclerview-v7:25.3.1'\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    testCompile \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'junit:junit:4.12'\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch3 id=\"add-the-recycler-view-to-the-layout\"># Add the Recycler view to the layout.\u003C\u002Fh3>\n\u003Cp>Open your layout file and add the View.\u003C\u002Fp>\n\u003Cdiv class=\"code-block\" data-lang=\"xml\">\u003Cdiv class=\"code-block__header\">\u003Cspan class=\"code-block__lang\">xml\u003C\u002Fspan>\u003Cbutton type=\"button\" class=\"code-block__copy\" aria-label=\"Copy code\">Copy\u003C\u002Fbutton>\u003C\u002Fdiv>\u003Cdiv class=\"code-block__body\">\u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">&#x3C;?\u003C\u002Fspan>\u003Cspan style=\"color:#85E89D\">xml\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> version\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"1.0\"\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> encoding\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"utf-8\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">?>\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">&#x3C;\u003C\u002Fspan>\u003Cspan style=\"color:#85E89D\">RelativeLayout\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> xmlns:android\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">    xmlns:app\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres-auto\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">    xmlns:tools\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"http:\u002F\u002Fschemas.android.com\u002Ftools\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">    android:layout_width\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"match_parent\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">    android:layout_height\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"match_parent\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">    tools:context\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"skd.app.androidfeatures.sRecylerView.RecylerActivity\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">>\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">    &#x3C;!-- Recycler view -->\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    &#x3C;\u003C\u002Fspan>\u003Cspan style=\"color:#85E89D\">android.support.v7.widget.RecyclerView\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">        android:id\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"@+id\u002Fmy_recycler_view\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">        android:scrollbars\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"vertical\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">        android:layout_width\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"match_parent\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">        android:layout_height\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"match_parent\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">\u002F>\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">&#x3C;\u002F\u003C\u002Fspan>\u003Cspan style=\"color:#85E89D\">RelativeLayout\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">>\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch3 id=\"initializing-the-recycler-view-in-your-activity-class\"># Initializing the Recycler View in your activity class.\u003C\u002Fh3>\n\u003Cp>Recycler view requires 3 components to set it up.\u003C\u002Fp>\n\u003Cul>\n\u003Cli>The \u003Cstrong>Recycler view\u003C\u002Fstrong> widget from the layout.\u003C\u002Fli>\n\u003Cli>The \u003Cstrong>Data Adapter\u003C\u002Fstrong> for the view , This contain the data which need to be shown\u003C\u002Fli>\n\u003Cli>The \u003Cstrong>LayoutManager\u003C\u002Fstrong> , it defines how data is shown in the Layout.\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Cp>Now open your Activity Class which corresponds to the layout which contain the recycler view.\nand set up your Recycler View.\u003C\u002Fp>\n\u003Cdiv class=\"code-block\" data-lang=\"java\">\u003Cdiv class=\"code-block__header\">\u003Cspan class=\"code-block__lang\">java\u003C\u002Fspan>\u003Cbutton type=\"button\" class=\"code-block__copy\" aria-label=\"Copy code\">Copy\u003C\u002Fbutton>\u003C\u002Fdiv>\u003Cdiv class=\"code-block__body\">\u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.support.v7.app.AppCompatActivity;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.os.Bundle;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.support.v7.widget.LinearLayoutManager;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.support.v7.widget.RecyclerView;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> skd.app.androidfeatures.R;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> RecylerActivity\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> extends\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> AppCompatActivity\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">    \u002F\u002FBelow are the componets which are required by the Recycler view\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    RecyclerView recyclerView; \u003C\u002Fspan>\u003Cspan style=\"color:#6A737D\">\u002F\u002Fthis will hold the recycler view from the layout\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    RecyclerView.Adapter   mAdapter; \u003C\u002Fspan>\u003Cspan style=\"color:#6A737D\">\u002F\u002Fthis will hold the adapter for the recycler view\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    RecyclerView.LayoutManager mLayoutmanager; \u003C\u002Fspan>\u003Cspan style=\"color:#6A737D\">\u002F\u002Fholds the layout manager\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    protected\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> onCreate\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(Bundle \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">savedInstanceState\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">        super\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">onCreate\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(savedInstanceState);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">        setContentView\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(R.layout.activity_recyler); \u003C\u002Fspan>\u003Cspan style=\"color:#6A737D\">\u002F\u002Flayout which contain the recycler view\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002FFind the Recycler view\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        recyclerView \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> (RecyclerView)\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">findViewById\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(R.id.my_recycler_view); \u003C\u002Fspan>\u003Cspan style=\"color:#6A737D\">\u002F\u002Fgot the recycler view from the layout\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002Fset the layout manager for the recycler view\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002Fstandard layout managers( LinearLayoutManager or GridLayoutManager) can be used, or implement your own.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002FLayout Manager tells how the item are shown in your Recycler View\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        mLayoutmanager \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> new\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> LinearLayoutManager\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">this\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        recyclerView.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">setLayoutManager\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(mLayoutmanager);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002Fset the data adapter\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002FAdapter contain the Data Which need to be shown in the view\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        mAdapter \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> new\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> RvDataAdpt\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">();\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        recyclerView.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">setAdapter\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(mAdapter);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch3 id=\"recycler-view-item\">#Recycler View Item\u003C\u002Fh3>\n\u003Cp>Now we need to create and recycler item , i.e the layout which can be shown by the recycler view.\nAdd layout \u003Cstrong>recycler_item.xml\u003C\u002Fstrong>\u003C\u002Fp>\n\u003Cp>\u003Ca href=\"\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-01.webp\">\u003Cimg src=\"\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-01.webp\" alt=\"Screenshot 4\" \u002F>\u003C\u002Fa>\u003C\u002Fp>\n\u003Cdiv class=\"code-block\" data-lang=\"xml\">\u003Cdiv class=\"code-block__header\">\u003Cspan class=\"code-block__lang\">xml\u003C\u002Fspan>\u003Cbutton type=\"button\" class=\"code-block__copy\" aria-label=\"Copy code\">Copy\u003C\u002Fbutton>\u003C\u002Fdiv>\u003Cdiv class=\"code-block__body\">\u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">&#x3C;?\u003C\u002Fspan>\u003Cspan style=\"color:#85E89D\">xml\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> version\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"1.0\"\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> encoding\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"utf-8\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">?>\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">&#x3C;\u003C\u002Fspan>\u003Cspan style=\"color:#85E89D\">LinearLayout\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> xmlns:android\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">    android:layout_width\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"match_parent\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">    android:layout_height\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"wrap_content\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">    android:layout_marginTop\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"10dp\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">    android:orientation\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"vertical\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">>\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    &#x3C;\u003C\u002Fspan>\u003Cspan style=\"color:#85E89D\">TextView\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">        android:id\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"@+id\u002FtextView\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">        android:layout_width\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"match_parent\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">        android:layout_height\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"wrap_content\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">        android:text\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"Hii \"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">        android:textSize\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"30sp\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> \u002F>\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">&#x3C;\u002F\u003C\u002Fspan>\u003Cspan style=\"color:#85E89D\">LinearLayout\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">>\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch3 id=\"the-data-adapter\"># The Data Adapter\u003C\u002Fh3>\n\u003Cp>The data Adapter is the component which feeds to the recycler view. In the post I will describe how to set up the basic adapter class to able to show the view. listening events from the view will be decribed in a later post :).\nAs per Android doc your adapter class must extent \u003Ca href=\"https:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv7\u002Fwidget\u002FRecyclerView.Adapter.html\">RecyclerView.Adapter\u003C\u002Fa> class from the support library.\u003C\u002Fp>\n\u003Cdiv class=\"code-block\" data-lang=\"java\">\u003Cdiv class=\"code-block__header\">\u003Cspan class=\"code-block__lang\">java\u003C\u002Fspan>\u003Cbutton type=\"button\" class=\"code-block__copy\" aria-label=\"Copy code\">Copy\u003C\u002Fbutton>\u003C\u002Fdiv>\u003Cdiv class=\"code-block__body\">\u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.support.v7.widget.RecyclerView;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.view.LayoutInflater;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.view.View;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.view.ViewGroup;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> skd.app.androidfeatures.R;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">\u002F**\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"> * THis class will be the data adapter for the recycler view\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"> * This class must exxtend the Recycler view adapter.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"> *\u002F\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> RvDataAdpt\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> extends\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> RecyclerView.Adapter\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    @\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">Override\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> RecyclerView.ViewHolder \u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">onCreateViewHolder\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(ViewGroup \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">parent\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">int\u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\"> viewType\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> null\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    @\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">Override\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> onBindViewHolder\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(RecyclerView.ViewHolder \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">holder\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">int\u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\"> position\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    @\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">Override\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> int\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> getItemCount\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">() {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Cp>These methods are need overridden by the base class.\n\u003Cstrong>onCreateViewHolder\u003C\u002Fstrong> : This method used to construct the view holder and set the view it uses\nto display its contents. Typically, it would set the view by inflating an XML layout file.\n\u003Cstrong>onBindViewHolder\u003C\u002Fstrong> : Called by RecyclerView to display the data at the specified position. This method should update the contents of the itemView to reflect the item at the given position.\n\u003Cstrong>getItemCount\u003C\u002Fstrong> : Returns the total number of items in the data set held by the adapter.\u003C\u002Fp>\n\u003Cp>For more info visit \u003Ca href=\"https:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv7\u002Fwidget\u002FRecyclerView.Adapter.html\">Recycler Adapter\u003C\u002Fa>\u003C\u002Fp>\n\u003Cp>At this point if you run the application. Recycler view will be visible however with no item.\u003C\u002Fp>\n\u003Cp>Now lets try to display our item layout in the recycler.\u003C\u002Fp>\n\u003Cp>To display the item in the recycler view we need to inflate our item in the \u003Cstrong>onCreateViewHolder\u003C\u002Fstrong>method however. However this method return data of \u003Cstrong>\u003Ca href=\"https:\u002F\u002Fdeveloper.android.com\u002Freference\u002Fandroid\u002Fsupport\u002Fv7\u002Fwidget\u002FRecyclerView.ViewHolder.html\">RecyclerView.ViewHolder\u003C\u002Fa>\u003C\u002Fstrong> , so we first need to convert or return our view as \u003Cstrong>ViewHolder\u003C\u002Fstrong> type. By creating instance of ViewHolder Class.\u003C\u002Fp>\n\u003Cp>To set the count of the item displayed. getItemCount should return value greater than 0.\u003C\u002Fp>\n\u003Cdiv class=\"code-block\" data-lang=\"java\">\u003Cdiv class=\"code-block__header\">\u003Cspan class=\"code-block__lang\">java\u003C\u002Fspan>\u003Cbutton type=\"button\" class=\"code-block__copy\" aria-label=\"Copy code\">Copy\u003C\u002Fbutton>\u003C\u002Fdiv>\u003Cdiv class=\"code-block__body\">\u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.support.v7.widget.RecyclerView;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.view.LayoutInflater;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.view.View;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> android.view.ViewGroup;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> skd.app.androidfeatures.R;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">\u002F**\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"> * THis class will be the data adapter for the recycler view\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"> * This class must exxtend the Recycler view adapter.\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"> *\u002F\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> RvDataAdpt\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> extends\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> RecyclerView.Adapter\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    @\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">Override\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> RecyclerView.ViewHolder \u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">onCreateViewHolder\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(ViewGroup \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">parent\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">int\u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\"> viewType\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002Flets populate our recyler view with the item created;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002Fget the view from the layout inflator\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002F  third parameter is set to false to prevent viewgroup to attach to root\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        View view \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> LayoutInflater.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">from\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(parent.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">getContext\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">()).\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">inflate\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(R.layout.recycler_item,parent,\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">false\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">);\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002F as this method need to return the viewHolder type\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">        \u002F\u002F need to convert our view to the view holder\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        RecyclerView.ViewHolder viewHolder \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> new\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> RecyclerView.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">ViewHolder\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(view) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            @\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">Override\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">            public\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> String \u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">toString\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">() {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">                return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> super\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">.\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\">toString\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">();\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        };\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        return\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> viewHolder;\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    @\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">Override\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> void\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> onBindViewHolder\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(RecyclerView.ViewHolder \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">holder\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">int\u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\"> position\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    @\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">Override\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    public\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> int\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> getItemCount\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">() {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\">  \u002F\u002Fthis defined how many items need to be displayed\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 3000\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">; \u003C\u002Fspan>\u003Cspan style=\"color:#6A737D\">\u002F\u002F to display the 3000 items\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Cp>Now After compiling and running the application you will get something like this.\u003C\u002Fp>\n\u003Cp>\u003Ca href=\"\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-02.webp\">\u003Cimg src=\"\u002Fmedia\u002Fseed\u002Fimported\u002F2017-07-android-recycler-view-tutorial-02.webp\" alt=\"Screenshot 1\" \u002F>\u003C\u002Fa>\u003C\u002Fp>\n\u003Cp>In the next post I will describe how to use Recycler view with proper items ,with data model and listing to the events of the items.\nSource Code : -\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fsapandang\u002FAndroidFeatures\">https:\u002F\u002Fgithub.com\u002Fsapandang\u002FAndroidFeatures\u003C\u002Fa>\u003C\u002Fp>\n",1795877411964]