title: Pass String Array from one fragment to another
body: <p>I am Using one String [] to display in ListView of fragmentone and pass String[] to fragmentTwo which has listView. my tried Codes below,</p>
  
  <p>MainActivity:</p>
  
  <pre><code>public class MainActivity extends FragmentActivity implements ListInterface {
  
  private FragmentOne fragmentOne;
  private FragmentTwo fragmentTwo;
  
  @Override
  protected void onCreate (Bundle savedInstanceState) {
      super.onCreate (savedInstanceState);
      setContentView (R.layout.activity_main);
  
       fragmentOne = new FragmentOne ();
      fragmentTwo = new FragmentTwo ();
  
      FragmentManager fragmentManager = getSupportFragmentManager ();
      android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction ();
  
      fragmentTransaction.add (R.id.frame_one,fragmentOne);
      fragmentTransaction.add (R.id.frame_two , fragmentTwo);
  
      fragmentTransaction.commit ();
  }
  
  @Override
  public void getValue (String[] s) {
      fragmentTwo.setValue (s);
  }}
  </code></pre>
  
  <p>FragmentOne:</p>
  
  <pre><code>public class FragmentOne extends Fragment {
  
  private ListView listView;
  private ListInterface listInterface;
  String [] listData = {"Dhana","Rahul","Strobs","Uday","Selvi"};
  
  @Override
  public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View view = inflater.inflate (R.layout.fragment_one,container,false);
      listView = (ListView)view.findViewById (R.id.lst_view);
      ArrayAdapter adapter = new ArrayAdapter (getActivity (),R.layout.fragment_one,listData);
      listView.setAdapter (adapter);
      return view;
  }
  
  @Override
  public void onAttach (Context context) {
      super.onAttach (context);
  
      if(context instanceof  ListInterface){
          listInterface =(ListInterface)context;
          listInterface.getValue (listData);
      }else{
          throw new ClassCastException (context.toString ()+"mess ");
      }
  }}
  </code></pre>
  
  <p>FragmentTwo:</p>
  
  <pre><code>public class FragmentTwo extends Fragment {
  
  private ListView listView;
  
  @Override
  public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
      View view = inflater.inflate (R.layout.fragment_two,container,false);
      listView = (ListView)view.findViewById (R.id.lst_view_two);
      return view;
  }
  
  public void setValue (String [] value){
      ArrayAdapter adapter = new ArrayAdapter (getActivity (),R.layout.fragment_two,value);
      listView.setAdapter (adapter);
  }}
  </code></pre>
  
  <p>ListInterface:</p>
  
  <pre><code>public interface ListInterface {
  
  public void getValue (String [] s);}
  </code></pre>
  
  <p>i tried my codes it show </p>
  
  <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference
   FragmentTwo.setValue(FragmentTwo.java:27)
   MainActivity.getValue(MainActivity.java:31)
   FragmentOne.onAttach(FragmentOne.java:37)
  </code></pre>