Communication between Fragments in ViewPager

You could use Intents (register broadcast receiver in fragment B and send broadcasts from fragment A. Use EventBus: https://github.com/greenrobot/EventBus. It’s my favorite approach. Very convinient to use, easy communications between any components (Activity & Services, for example). Steps to do: First, create some class to represent event when your text changes: public class TextChangedEvent { … Read more

ViewPager + RecyclerView issue in android

I see a lot of problems with your code, but let’s get your UI displaying the subcategories since that’s your main concern. Change the getItem in your adapter to this: @Override public Fragment getItem(int position) { ArrayList<SubcategoryModel> subcategories = filelist.get(position).getItems(); Log.v(“adapter”, “getitem” + String.valueOf(position)+subcategories.size()); return FirstFragment.create(position,subcategories); } What caused the problem: Let’s focus on ArrayList<SubcategoryModel> … Read more

What is the difference between FragmentPagerAdapter and FragmentStatePagerAdapter?

Like the docs say, think about it this way. If you were to do an application like a book reader, you will not want to load all the fragments into memory at once. You would like to load and destroy Fragments as the user reads. In this case you will use FragmentStatePagerAdapter. If you are … Read more