title: Nested Fragments Communication
body: <p>I'm currently having trouble with nesting fragments , I've created a <code>SlidingTabLayout</code> with two tabs , each tab with it's corresponding Fragment , In one tab I've added 5 child fragments to the parent fragment returned by the <code>FragmentPagerAdapter</code>, but I'm having trouble with the communication between the parent fragment and it's fragment children ,    </p>
  
  <pre><code>@Override
  public void onActivityCreated(@Nullable Bundle savedInstanceState) {
      super.onActivityCreated(savedInstanceState);
  
              FragmentTransaction childManager=getChildFragmentManager().beginTransaction();
              childManager.add(R.id.linear08,new YearFragment08(),"year08");
              childManager.commit();
              YearFragment08 year08=(YearFragment08)getChildFragmentManager().findFragmentByTag("year08");
              year08.setinfo("This is fantastic");
  
  
  }
  </code></pre>
  
  <p>`</p>
  
  <pre><code>public class YearFragment08 extends Fragment {
  TextView yearInfo;
  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
      View v=inflater.inflate(R.layout.year_frag08,container,false);
      yearInfo=(TextView)v.findViewById(R.id.txt_yearInfo_08);
      return v;
  }
   public void setinfo(String data){
      yearInfo.setText(data);
  }
  </code></pre>
  
  <p>And THIS is the result .</p>
  
  <pre><code>02-09 21:45:48.078    2177-2177/com.compassasu.compass E/AndroidRuntime﹕ FATAL EXCEPTION: main
  Process: com.compassasu.compass, PID: 2177
  java.lang.NullPointerException: Attempt to invoke virtual method 'void com.compassasu.compass.Fragments.YearFragment08.setinfo(java.lang.String)' on a null object reference
          at com.compassasu.compass.Fragments.HistoryFragment.onActivityCreated(HistoryFragment.java:33)
          at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1970)
          at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1051)
          at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1207)
          at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:738)
          at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1572)
          at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:545)
          at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141)
          at android.support.v4.view.ViewPager.populate(ViewPager.java:1106)
          at android.support.v4.view.ViewPager.populate(ViewPager.java:952)
          at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1474)
          at android.view.View.measure(View.java:18788)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
          at android.view.View.measure(View.java:18788)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
          at android.support.v7.internal.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:124)
          at android.view.View.measure(View.java:18788)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
          at android.view.View.measure(View.java:18788)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
          at android.view.View.measure(View.java:18788)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
          at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1465)
          at android.widget.LinearLayout.measureVertical(LinearLayout.java:748)
          at android.widget.LinearLayout.onMeasure(LinearLayout.java:630)
          at android.view.View.measure(View.java:18788)
          at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
          at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
          at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2643)
          at android.view.View.measure(View.java:18788)
          at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2100)
          at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1216)
          at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1452)
          at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
          at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
          at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
          at android.view.Choreographer.doCallbacks(Choreographer.java:670)
          at android.view.Choreographer.doFrame(Choreographer.java:606)
          at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
          at android.os.Handler.handleCallback(Handler.java:739)
          at android.os.Handler.dispatchMessage(Handler.java:95)
          at android.os.Looper.loop(Looper.java:148)
          at android.app.ActivityThread.main(ActivityThread.java:5417)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  </code></pre>
  
  <p>All I want to know is how does a child fragment receive data from the parent fragment .</p>