‫Let's move to the main activity and start populating the list of you with the data of the array list.
‫Start initializing the list of you alt plus enter to import the package and of the widgets and the list
‫of you class list view Find view by ID or ID dot list view.
‫So the first step in creating the list of views is to create the adapter view, which is a list of view,
‫and we define it here.
‫The second step is the data source.
‫And in this case, and in this app, it's array list of planet class and I need to define it here.
‫Array List of type planet planets array list planets array list equals new array list.
‫The array list is a dynamic data structure provided by Java Collections Framework, and it's used to
‫store and manage collections of objects in a flexible and resizable array like format.
‫Unlike the traditional arrays in Java, which have a fixed size, an array list can dynamically grow
‫or shrink in size as elements are added or removed.
‫So I created this array list that holds planet objects in a dynamic way so that this array list can
‫automatically adjust its size to accommodate the number of planets it holds.
‫So you don't need to specify the size of an array list upfront.
‫The Array list class provides a wide range of methods for adding, removing, searching or modifying
‫the elements.
‫So I'll use planets array list, dot add method.
‫And here I need to add a planet object and to add the new planet I need to create a new planet.
‫Or I can make like this.
‫I can create the planets here.
‫Planets, objects, Planet one equal new planet object and here I need to specify the planet.
‫Name the moon count and the planet image for the images of the planets.
‫I prepared these nine images.
‫I'll copy them and paste them into the drawable folder.
‫And the first planet is the earth.
‫The moon count is one and the image resource is r dot drawable dot earth.
‫When you create this planet object, I can add it to the planets array list using the Add method.
‫Add planet number one and here we go.
‫That's it.
‫I created this planet object and I'm adding it to the array list.
‫Now let's create the other planets.
‫I'll add them here to our array list.
‫And the third step is the adapter.
‫Adapter, in our example is a custom adapter that we created before.
‫I'll create an object of this custom adapter and I'll name it as adapter.
‫Scroll down to initialize it adapter equal to new my custom adapter and I need to pass two parameters
‫ray list and the context.
‫So planets array list and get application context.
‫So this application get application context method is used to obtain the global application context.
‫It's a method provided by the context class commonly used throughout the Android development to access
‫application level resources and services.
‫And then I need to add list of view dot set adapter and link it with our adapter.
‫Let's run our application an save it run and here we go.
‫This is our amazing application that displays planets with their images and moons.
‫I don't like.