Populate list of custom view using ListFragment

I solved my problem (as system32 suggests on comment) creating a CustomArrayAdapter class, and setting it as the adapter for my listView. First I changed android:id=”@+id/listView1″ to android:id=”@android:id/list” in fragment.xml. CustomArrayAdapter.java public class CustomArrayAdapter extends ArrayAdapter<Menu> { Context context; public CustomArrayAdapter(Context context, int textViewResourceId, List<Menu> objects) { super(context, textViewResourceId, objects); // TODO Auto-generated constructor stub … Read more

What is difference between getSupportFragmentManager() and getChildFragmentManager()?

The definition of getChildFragmentManager() is: Return a private FragmentManager for placing and managing Fragments inside of this Fragment. Meanwhile the definition of getFragmentManager() (or in this case getSupportFragmentManager()) is: Return the FragmentManager for interacting with fragments associated with this fragment’s activity. Basically, the difference is that Fragment’s now have their own internal FragmentManager that can … Read more

Update data in ListFragment as part of ViewPager

Barkside’s answer works with FragmentPagerAdapter but doesn’t work with FragmentStatePagerAdapter, because it doesn’t set tags on fragments it passes to FragmentManager. With FragmentStatePagerAdapter it seems we can get by, using its instantiateItem(ViewGroup container, int position) call. It returns reference to fragment at position position. If FragmentStatePagerAdapter already holds reference to fragment in question, instantiateItem just … Read more