A simple demonstration of the RecyclerView

Overview

RecyclerViewDemo

It is a simple demonstration of the implementation of the RecyclerView Android widget.

Demonstration

Here is the RecyclerView's adapter:

public class NameAdapter extends RecyclerView.Adapter<NameAdapter.ViewHolder> {
    private final ArrayList<Name> names;

    public NameAdapter(ArrayList<Name> names) {
        this.names = names;
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        ItemNameBinding binding = ItemNameBinding.
                inflate(LayoutInflater.from(parent.getContext()), parent, false);

        return new ViewHolder(binding);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        .
        .
        .
    }

    @Override
    public int getItemCount() {
        return names.size();
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        private final ItemNameBinding mBinding;

        public ViewHolder(ItemNameBinding binding) {
            super(binding.getRoot());
            mBinding = binding;
        }

        public ItemNameBinding getBinding() {
            return mBinding;
        }
    }
}

To return the binding dynamically in onBindViewHolder(), public ItemBindingName getBinding() is defined, which is the value of binding passed by the line:

return new ViewHolder(binding);

After setting the adapter, the RecyclerView is successfully able to build a list of the type defined in item_name.xml's CardView.

You might also like...

👮🏻‍♀️ simple k8s admission controller using spring boot

spring admission controller Spring boot를 이용해 만든 간단한 Kubernetes admission controller 입니다. Admission controller의 Validating webhook을 이용하여 Pod의 생성을 제한합니다

Dec 22, 2021

This is a simple realization of custom messages pre/post processing in spring-boot HTTP/Stream requests & responses

spring-boot-custom-message-converting-instances This is a simple realization of custom messages converting in spring-boot HTTP requests and responses.

Jul 22, 2022

A simple quarkus app with hibernate as ORM, used to show the features of Hibernate Search

beer-manager-hibernate-search Project This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, ple

Jan 6, 2022

Simple Calender App Written in Java , Built with Gradle

Simple Calender App Written in Java , Built with Gradle

Simple Calendar Simple Calendar is an just another open-source Android Calendar application written in java. Features Minimal & Clean Fullfilles needs

Dec 3, 2021

Shitty, yet simple way to get someone's token right at their discord client's startup.

discord-token-stealer Shitty, yet simple discord injector to add a little spice to their discord client Disclaimer: This is for educational purposes o

Sep 26, 2022

A simple app to use Xposed without root, unlock the bootloader or modify system image, etc.

A simple app to use Xposed without root, unlock the bootloader or modify system image, etc.

中文文档 Introduction VirtualXposed is a simple App based on VirtualApp and epic that allows you to use an Xposed Module without needing to root, unlock t

Jan 8, 2023

Simple and extensible identity management service

AuthGuard An easy-to-use, and easy-to-customize, identity server. It supports multiple authentication and authorization options and can be extended to

Jan 9, 2022

Spring Boot Simple Login & Registration + MyBatis + MySQL

springboot-mybatis-security-login-register A simple security login & registration module using Spring Boot, Spring Security, MyBatis Framework and MyS

May 31, 2022

A simple online Quiz App made by using Firebase firestore database.

A simple online Quiz App made by using Firebase firestore database.

Quiz App Online Description Quiz App is an Online quiz maker app that can be used to create effective quizzes by teachers. This app uses Firebase Fire

Dec 30, 2021
Owner
Rohan Bari
Computer programmer
Rohan Bari
This is an example of how conditional events can be triggered in Camunda using a simple spring boot project

Camunda Conditional Events Example This example is a Spring Boot Application using Camunda. In this example i'll show a variety of ways that BPMN's Co

Niall 5 Sep 30, 2021
Simple AnimationUtil using Easing functions. Can be used anywhere, Hacked-Client, Mods, etc..

AnimationUtil Simple AnimationUtil using Easing functions. Can be used anywhere, Hacked-Client, Mods, etc.. Render example > https://gyazo.com/780b5d8

null 71 Jan 8, 2023
A simple implementation of the Dubbo protocol.

Codec-dubbo Codec-dubbo is a binary codec framework for dubbo protocol Features Fully compatible with Dubbo protocol Completely rewritten based on Net

ESA Stack 13 Nov 21, 2022
a simple program to turn stockX images into gifs!

StockX Gif Converter make stockx images look cool Idea I got this idea from Fyko/stockx-gif-next Usage import me.brennan.stockxgiffer.StockXGiffer; p

Brennan 7 Jul 19, 2022
Super simple deploy using spring boot, docker, k8s and kind

Target Target of this repository is show how to build spring boot application Docker image and deploy it with kind and k8s at least in local. Prerequi

Max 4 Aug 22, 2021
a simple mini-project using Spring framework

Room Reservation Service First attempts to learn Spring with Linkedin-Learning led me to create this mini-project; a simple room reservation service f

Taha Elmi 4 Sep 23, 2021
Simple and lightweight application which is checking status of your web services and send a notification if it is down.

rose-uptimer Simple and lightweight application which is checking status of your web services and send a notification if it is down. Example configura

RoseSapphire 3 Sep 25, 2022
GodType is a very simple Bukkit plugin to allow the console (or a player) to chat as a defined name.

GodType GodType is a very simple Bukkit plugin to allow the console (or a player) to chat as a defined name. Config A config.yml file will be created

null 1 Dec 24, 2021
A simple plugin to load behavior packs from the 'behavior_packs' folder.

Behaviour Pack Loader for Nukkit A simple plugin to load behavior packs from the behavior_packs folder. If you found any bugs or have any suggestions,

Woder 14 Dec 7, 2022
A simple and scalable Android bot emulation framework, as presented at Black Hat Europe 2021's Arsenal, as well as atHack 2021's Arsenal

m3 A simple and scalable Android bot emulation framework. A detailed explanation can be found here. This project was first published at Black Hat Euro

null 22 Aug 20, 2022