title: how to pass the data in between activity to fragment using bundle in android
body: <p>I can store the value in one variable. Now I want pass that variable into a fragment 
  Using the code below, I am able to load fragments:</p>
  
  <pre><code>public class AndroidListFragmentActivity extends Activity {
      Fragment2 f2;
      public static String itemname;
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.apetiserfragement);
          itemname=getIntent().getStringExtra("itemname");
          Bundle args=new Bundle();
          args.putString("itemname", itemname);
          f2=new Fragment2();
          f2.setArguments(args);
      }
  } /* (Here I load fragment using xml page) itemname */
  </code></pre>
  
  <p>The output is splitted into 2 windows one for extend for listfragment (for listview) and one for fragments.</p>
  
  <p>Fragment2.xml</p>
  
  <pre><code>public class Fragment2 extends Fragment {
      String itemname;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
      Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          System.out.println(getArguments().getString("itemname"));
  
          return inflater.inflate(R.layout.fragment2, container, false);
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          super.onCreate(savedInstanceState);
      }
  }
  </code></pre>
  
  <p>AndroidListFragmentActivity in this class itemname I want pass Fragment2.class.. please help me</p>