Introduction

Today, I am starting with custom classes and data sources and furthermore how we show fake data in the list view using the adapter after the configuration of GIT version control and create a new Android project and set it.
Refer to the article series below
Step 1
Make a simple project with empty activity and then in the main activity design one button and add one layout and one activity for showing a product list.
xml
Here you see the code of the listview button.
xml
Step 2
Then create the following classes into a Java folder and add one layout in the layout section.
section
Layout Section
xml
Step 3
Now add one method in MainActivity.Class because when the user clicks on the listview button then it moves on second activity and the name of the second activity is ListViewActivity.Class
code
Step 4
Now In Product. The class adds some attributes like product name, price, image, and description and then make a getter and setter methods of those attributes.
code
Step 5
In ProductDatasource.java class we make an arraylist because the benefit of arraylist is that it makes an array size at runtime and in arraylist we declare a loop because we show multiple items in the listview, not one, in this way we declare loop.

Why data source?

Its important functions

What is ArrayList?

Items can add by
add () and remove by remove ()
code
Step 6
Now in make ProductListActivity.java we declare a data source and connect with this class,
code
Read more articles on Android