‫Welcome back.
‫We created the layouts.
‫We created the model class.
‫We created the adapter class.
‫Now let's move to the main activity Wkt file.
‫And let's combine these parts together here.
‫Inside the Oncreate method we need to initialize the views the recycler view val recycler view.
‫It's of type recycler view equals to find view by id or.id dot recycler view then recycler view dot
‫layoutmanager equals to linearlayoutmanager.
‫And here I need to pass the three parameters of this linear layout manager this linear layout manager
‫dot vertical and false.
‫The linear layout manager is configured to manage a recycler view, where items are arranged vertically
‫in a single column and the layout order in from top to bottom.
‫This is a common configuration for a vertical list of items in a recycler view.
‫Let's start with the first parameter.
‫This.
‫The first parameter is the context.
‫In Android.
‫You often use this in the context of an activity or fragment to refer to the current context, and since
‫we are working with the main activity, I'm referring to this context.
‫The context of the main activity.
‫Linear layout manager dot vertical.
‫The second parameter specifies the orientation of the recycler view.
‫In this case it's set to vertical, meaning that the items in the recycler view will be arranged vertically
‫in a single column.
‫False.
‫The third parameter indicates whether the layout should be reversed laid out.
‫If set to true, the layout will be bottom to top for vertical orientation or right to left for horizontal
‫orientation.
‫In this case, it's set to false, indicating regular layout order.
‫The second step is to create the data source, and as I told you, the data source of our app is a list
‫of sports model objects sports list type, array list.
‫And here I need to specify the generic type sport model equals to array list.
‫I'll start creating the objects that I need to put inside the sports list.
‫Port one equals to sport model r dot drawable dot football.
‫And here you specify the sport name.
‫I'll continue with the other objects.
‫But here we go.
‫These are my objects.
‫Now let's add them to the sports list.
‫Sport list, dot add sport one, and so on.
‫And the last step is to create the adapter.
‫Val adapter equals to sports adapter.
‫And here I need to pass the sports list that I created here RecyclerView dot adapter equals to adapter.
‫Here I am linking the RecyclerView with the adapter, save the project and run.
‫And if you encountered this error, I talked about it in many videos.
‫Just go to the Gradle scripts and here change it to 34 and 34.
‫Okay sync now and run again.
‫And here we go.
‫This is our amazing application.
‫This is the image view header.
‫And this is our recycler view that contains card views.
‫Again guys card view is a UI widget in Android that provides a flexible and visually appealing way to
‫display content in a card like structure.
‫The purpose of card View is to create a consistent and material design inspired container for presenting
‫information.
‫So congratulations guys!
‫We succeeded in creating this amazing app that displays card views in our recycler view.