title: Passing a String from FragmentActivity to ListFragment
body: <p>I have exhausted all my searches.In essence what I'm trying to accomplish is to pass a string in my FragmentActivity to a ListFragment. Below is my code:</p>
  
  <p>MyActivity.java</p>
  
  <pre><code>package com.application.smst.smstapp;
  
  import android.app.ActionBar;
  import android.app.Activity;
  import android.app.FragmentManager;
  import android.app.FragmentTransaction;
  import android.app.ProgressDialog;
  import android.graphics.Color;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.support.v4.view.ViewPager;
  import android.text.util.Linkify;
  import android.util.Log;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.ImageView;
  import android.widget.ScrollView;
  import android.widget.TextView;
  import android.widget.Toast;
  import org.apache.http.HttpEntity;
  import org.apache.http.HttpResponse;
  import org.apache.http.NameValuePair;
  import org.apache.http.ParseException;
  import org.apache.http.client.ClientProtocolException;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.entity.UrlEncodedFormEntity;
  import org.apache.http.client.methods.HttpPost;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.message.BasicNameValuePair;
  import org.json.JSONArray;
  import org.json.JSONException;
  import org.json.JSONObject;
  import android.support.v4.widget.SwipeRefreshLayout;
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.text.SimpleDateFormat;
  import java.util.ArrayList;
  import java.util.Date;
  
  import com.application.smst.smstapp.adapter.TabsPagerAdapter;
  
  
  
  
  public class MyActivity extends FragmentActivity implements ActionBar.TabListener {
  
  private ViewPager viewPager;
  private ActionBar actionBar;
  // Tab titles
  
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_my);
      // Initilization
  
      String[] tabs = { "LOA", "OT", "My "+getIntent().getExtras().getString("result_mover") };
      ////////////////////////////////////////////////////
      String message = getIntent().getExtras().getString("result_mover");
      Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
  
      ////////////////////////////////////////////////////
      viewPager = (ViewPager) findViewById(R.id.pager);
      actionBar = getActionBar();
      TabsPagerAdapter mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
  
      viewPager.setAdapter(mAdapter);
      actionBar.setHomeButtonEnabled(false);
      actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  
      // Adding Tabs
      for (String tab_name : tabs) {
          actionBar.addTab(actionBar.newTab().setText(tab_name)
                  .setTabListener(this));
      }
      /**
       * on swiping the viewpager make respective tab selected
       * */
      viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
  
          @Override
          public void onPageSelected(int position) {
              // on changing the page
              // make respected tab selected
              actionBar.setSelectedNavigationItem(position);
          }
  
          @Override
          public void onPageScrolled(int arg0, float arg1, int arg2) {
          }
  
          @Override
          public void onPageScrollStateChanged(int arg0) {
          }
      });
  }
  
  @Override
  public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {
  }
  
  @Override
  public void onTabSelected(ActionBar.Tab tab, FragmentTransaction ft) {
      // on tab selected
      // show respected fragment view
      viewPager.setCurrentItem(tab.getPosition());
  }
  
  @Override
  public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction ft) {
  }
  
  
  }
  </code></pre>
  
  <p>The variable I'm trying to pass is the message string</p>
  
  <pre><code>String message = getIntent().getExtras().getString("result_mover");
  </code></pre>
  
  <p>The data was passed from another activity successfully. But now i have to get it to my listfragment, which is one of the three tabs(fragments) that are contained by the above fragment activity. Below is the listfragment code:</p>
  
  <p>schfragment.java</p>
  
  <pre><code>package com.application.smst.smstapp;
  
  
  import java.util.ArrayList;
  import java.util.List;
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.v4.app.ListFragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  import android.widget.Toast;
  
  /**
   * Created by Admin on 10/5/2014.
   */
  public class schfragment extends ListFragment {
  String[] menuweekday;
  String[] menudate;
  String[] menustart;
  String[] menuend;
  CustomAdapter adapter;
  private List&lt;RowItem&gt; rowItems;
  
  @Override
  public View onCreateView(LayoutInflater inflater,ViewGroup container, Bundle savedInstanceState){
  
  
      ////////////////////////////////////////
      return inflater.inflate(R.layout.fragment_sch, container, false);
  
  
  
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  menuweekday = getResources().getStringArray(R.array.weekdays);
  menudate = getResources().getStringArray(R.array.dates);
  menustart = getResources().getStringArray(R.array.starts);
  menuend = getResources().getStringArray(R.array.ends);
  
  rowItems = new ArrayList&lt;RowItem&gt;();
  
  for (int i = 0; i&lt; menuweekday.length;i++){
      RowItem items = new RowItem(menuweekday[i],menudate[i],menustart[i],menuend[i]);
      rowItems.add(items);
  }
  adapter = new CustomAdapter(getActivity(),rowItems);
      setListAdapter(adapter);
  
  }
  
  }
  </code></pre>
  
  <p>Any help with this would be greatly greatly appreciated.</p>
  
  <p>I have tried using Bundles, this would result in NPE. I dont know where to put the code correctly</p>
  
  <p>Thank you in advance. and let me know if I need to post my tabspager adapter</p>