I have an ActionBarActivity which implements ActionBar.TabListener as shown below
public class MainActivity extends ActionBarActivity implements
ActionBar.TabListener {
viewPager = (ViewPager) findViewById(R.id.pager);
actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
viewPager.setAdapter(mAdapter);
Tab tab1 = actionBar.newTab();
tab1.setText("Home");
tab1.setTabListener(this);
actionBar.addTab(tab1);
//I have other few tabs as well }
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int arg0) {
// TODO Auto-generated method stub
actionBar.setSelectedNavigationItem(arg0);
}
I have some ListFragment like the one below..
public class Home extends ListFragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.home, container, false);
return rootView;
}
}
I need to send certain key or value from MainActivity to ListFragment according to certain condition. How do I achieve that? And how do I recieve those values from ListFragment? And I am using ViewPager as well. So I won't be able to pass static fragment name.