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

  • Well ... Looks like something is wrong in the adapter for lists ... There are no errors in your code. - Yuriy SPb
  • And where is the error in the adapter? It’s just the same on every page. What to dig? - Iman
  • Well ... Maybe you get the same data in all cases ... - Yuriy SPb
  • No, this can not be) Everything depends on the main Id. I have a CursorLoader there and is it static because of this? - Iman
  • Yes, maybe because of this. Static one and takes the value of the last something you assigned to him. - Yuriy SPb

0