GridView With CardView , Search and ClickListener
|GridView With CardView, Search / Filter and OnClickListner, GridView Items will Contain CardView, Image, Text, and Description. When clicked a new activity opens and displays the image and name of the clicked item. You can also perform search/filter within the gridview items either by name or description
Tutorial divided in 3 parts:
PART 1:
Create GridView with Image, text and Description:
Here we shall learn how to:
- Add gridview in our activity.
- Adding cardveiw library in our build gradle
- Create layout that will hold gridview items ( image, name, description ) in a cardview
create a modal that will hold data - Create Adapter class that will extend BaseAdapter ( this link data source to our gridview )
- Copy and Past our images
- Display our gridview
PART 2:
Adding Search/Filter to Our GridView:
Here we shall learn how to:
- Add menu items in adnroid studio
- Inflate menu item and display in our activity oncreate method.
- Implement filterable method in our adapter.
- Add another list of items that will contain filtered items.
- Perform the filter in our gridview.
Part 3:
Adding OnclickListener in our GridView:
Here we shall learn how to:
- Listen to the clicked gridview item.
- Create a new activity that will open when gridview item is clicked
- Open new activity when gridview is clicked
- Pass Data from clicked Grid Item to our new activity.
Related GridLayout with CardView:https://larntech.net/gridview-with-cardview-and-onclicklistener/
Android Docs GridView: https://developer.android.com/reference/android/widget/GridView
If you need additional help, Kindly comment below.
For source code of the whole project , You can get it for only $5 to support this work.