Android App Development
iOS App Development
Flutter 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 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
In erlier chapter, we understood how to make a custom setter and bind ImageView with a image url directly. Now we will learn data binding with recycler view. We are going to make an adapter which will have a viewholder.
So lets start with make a layout having your recyclerview as i did, lets call it activity_main.xml .
Now we will create a layout for list/ grid item. Here we will have a text and an image. But firstly we have to make a java entity/ class for the structure we want to bind.
item.xml:
As we are using app:imageUrl our custom setter so we have to define it. Here I am going to use picasso library if you want to use volley you can check it out from here.
Now we will create a recyclerview adapter. We will do it in MainActivity.java as
And thats all for binding a recycler view data. You can also make a view swicher to switch between different layouts in the recyclerview as you have seen in many apps that switch between grid and list view. But we will coontinue that in the next part.
Next>
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Name
Email
Subject
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.