Skip to content Skip to sidebar Skip to footer

Display List Of Data Based On Name And Image Object

I wanna display list of data based on name and image object with JSON volley. But can't display in accordance with expectations. For example: The expectation is, if I click Tea, it

Solution 1:

There is many ways you can implement here, like-

You can compare names in list of objects using String.equalsIgnoreCase() and place separately these matched objects and then display list according to those names.

Another one is Make HashMap whenerver you got response in JsonArray. For instance HashMap<String,ArrayList<HomeModel>> where you have to put String key as names like tea or cofee and ArrayList as a List of those objects whose names contains tea of coffee. So when you click on coffee, you can get List of objects by only key value like that-

ArrayList<HomeModel> models = hashmap.get("coffee");

Post a Comment for "Display List Of Data Based On Name And Image Object"