Native Shopify Mobile App with 20 new features
Kickstart your hyperlocal marketplace in Corona pandemic with a starter guide
Android App Development
iOS App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 220.127.116.11 release ready!
Owner and Founder. Opencart
RecyclerView is a successor view group of ListView and GridView.It has different features from ListView and GridView which makes it powerful.In this blog we will discuss about RecyclerView and its Adapter.
Creating New Project
1. In Android Studio, go to File ⇒ New Project and fill all the details required to create a new project. When it prompts to select a default activity, select Blank Activity and proceed.
2. Open build.gradle and add recycler view dependency.com.android.support:recyclerview-v7:28.0.0 and rebuild the project.
create view RecyclerView in activity_main.xml
The Card Layout: Card Layout is treated as an item of RecyclerView.
The Data Class: The class that holds information about recyclerView
The ViewHolder: ViewHolder holds information about card layout .
The Adapter: It is responsible for inflating the view and view holder ,binding data to view . It extends RecyclerView.Adapter .There are three main method of RecyclerView.Adapter which are necessary to override
1.onCreateViewHolder: This method only called when new view created. If views are recycled then there is no need to create new view.
2.onBindViewHolder:It sets data to particular items of the RecyclerView.It called every time when it scrolled
3.getItemCount: which Returns the length of the RecyclerView.
We use LayoutManager class for specifying position of recyclerView’s item.There are three ways of displaying RecyclerView data.
Set Adapter to RecyclerView
we need to set adapter to recyclerView which we created . we pass list in constructor of MyAdapter
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.