how to display listview in viewpager

373 viewslistview pagerview
X Fa | 12 xp


the above image shows a simple view of my app

there is some mysql databases on the server like restaurant names, categories and foods

in the activity 1 , the app shows restaurant names in a listview, by selecting one of them, activity 2 start and display categories of that restaurant in a horizontal recyclerview and foods of each category in a listview in each page of one pagerview. I could do that until the recyclerview section, but I dont know how to show foods of each category in a listview in each page of viewpager!

these are my xml and code:

Activity 2 java:

fragment_main xml:

Activity 2 xml :


Kanthikiran_Nalamati | 76 xp

if you know how to set the listview in the fragment or activity then it is like normal only..the only diff is you are adding the code in the view pager

Lakshmi Priya | 125 xp

you have to create one custom adapter with listview and set this adapter to view pager.


you may refer this page for reference :