I have a Fragment and a ListFragment both under a FragmentActivitiy. When I am in the Fragment, and I want to swipe to the ListFragment, how do I get the ListView to update?

Basically, I have an insert button/EditText in the Fragment and the user will insert new info. I want to swipe to the ListFragment and then dynamically SEE that new info. The only way to get it to refresh is by backing out of the parent activity and entering again.

I see there are methods onTabSelected or onTabReselected, not sure if this is where you do it?

Would it involve the typical code "Adapter.notifyDataSetChanged()"?

Edit: I am thinking maybe I just need to see how you can update a Fragment view in general?

有帮助吗?

解决方案

Think I answered my own question:

I have this code

public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {

    mViewPager = (ViewPager) findViewById(R.id.viewpager);
    mViewPager.setAdapter(mSectionsPagerAdapter);


}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top