title: How to pass data from main activity to fragment
body: <p>i am a newbie in android development. I am now seeking a solution on how i can pass a value from main activity to different fragments. My apps have a main activity and 5 fragments. I would like to do xml parsing in my main and then pass processed data to different fragments so that i can draw different pages at the same time. My main has set a new fragment adapter</p>
  
  <p>mAdapter = new FragmentAdapter(getSupportFragmentManager()); </p>
  
  <p>And then in my FragmentAdapter (which extend FragmentPagerAdapter and implements IconPagerAdapter), i have overwrite the getItem method so that i can create 5 fragment to handle 5 different pages.</p>
  
  <pre><code>@Override
  public Fragment getItem(int position) {
      Fragment fragment = new Fragment1();
      switch(position){
      case 0:
          fragment = new Fragment1();
          break;
      case 1:
          fragment = new Fragment2();
          break;
      case 2:
          fragment = new Fragment3();
          break;
      case 3:
          fragment = new Fragment4();
          break;
      case 4:
          fragment = new Fragment5();
          break;  
  
      }
      return fragment;
  }
  </code></pre>
  
  <p>My question is how i can pass some value from my main to the newly generated fragments.For e.g i would like to pass a value "A" from my main to fragment 1. How can i do this task? Tks in advance for your help!~</p>