There is a class myFragment type Fragment . MainActivity has a TabLayout and ViewPager .
You need to add ViewPager adapter to the ViewPager , add a lot of fragments. Each fragment changes only the Adapter from ListView . I tried to pass a parameter when creating a fragment and put a specific adapter for the ListView on this parameter, here's the code. But each time it shows 1 and the same adapter, although I made it in a button to show Id, which I placed in the arguments, it shows on each page a different one, i.e. your id How to be.
MainActivity
Adapter adapter = new Adapter(getSupportFragmentManager()); int i=1; while(i<114){ adapter.addFragment(new myFragment().setId(i),String.valueOf(i)); i++; } viewPager.setAdapter(adapter); myFragment class:
public class myFragment extends Fragment{ public myFragment setId(int myId){ Bundle args = new Bundle(); args.putInt("myId", myId); myFragment f = new myFragment(); f.setArguments(args); return f; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); idAdapter = getArguments().getInt("myId"); switch(idAdapter){ case 1: // Присваиваю адаптер к ListView с определенным курсором. break; case 2: // Присваиваю адаптер к ListView с определенным курсором. break; } ... OnCreateView