title: Two fragments hold by another fragment - findViewById returns null
body: <p>I need help for my first Android application. I have a single activity with an Action Bar at the top and Navigation Tabs. Because of these navigation tabs I had to convert my Activities into Fragments.</p>
  
  <p>So one of those Activities (which is now a Fragment) held two fragments, one ListFragment on the Left and a DetailFragment on the right, so that the user is able to select an item from the list and directly sees details on the right.</p>
  
  <p>But now as the Activity has been transformed into the Fragment, it's the Fragment that holds the List- and the DetailFragment. This works fine until I want to change the DetailsFragment.</p>
  
  <p>First of all, here is the code of the Fragment holding the other two:</p>
  
  <pre><code>public class BlackboardFragment extends Fragment {
  
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          return inflater.inflate(R.layout.fragment_layout, container, false);
      }
  
  }
  </code></pre>
  
  <p>Here is the fragment_layout.xml file (saved in layout-land):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="horizontal" &gt;
  
      &lt;fragment
          android:id="@+id/interfaces"
          android:layout_width="0px"
          android:layout_height="match_parent"
          android:layout_marginRight="20dp"
          android:layout_weight="0.60"
          class="org.fawkesrobotics.app.InterfaceFragment" /&gt;
  
      &lt;FrameLayout
          android:id="@+id/viewer"
          android:layout_width="0px"
          android:layout_height="match_parent"
          android:layout_weight="1" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>So, the ListFragment is named InterfaceFragment, here is the code:</p>
  
  <pre><code>public class InterfaceFragment extends ListFragment {
  
      boolean mDualPane;
  
  //      some other code
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setHasOptionsMenu(true);
  
          create_list();
  
          View viewerFrame = getActivity().findViewById(R.id.viewer);
          mDualPane = viewerFrame != null
                  &amp;&amp; viewerFrame.getVisibility() == View.VISIBLE;
  
          if (savedInstanceState != null) {
              mCurCheckPosition = savedInstanceState.getInt("curChoice", 0);
          }
      }
  
  //      some other code
  }
  </code></pre>
  
  <p>This is, where it doesn't work. The Fragment actually shows the list (that is created in create_list() where the ListAdapter and everything else is set), but my problem is, that viewerFrame is null. I declared the id viewer in the xml file above, so I don't understand why he cannot find the id. Does it "belong" to the BlackBoardFragment or to my overall activity? Because in BlackboardFragment I also tried it with getActivity().findViewById and it worked. Why is InterfaceFragment not able to find it?</p>
  
  <p>I also tested, if he really uses the fragment_layout.xml in layout-land and he does. So he should know the id viewer, but obviously doesn't.</p>
  
  <p>If you need more code or the code from the DetailsFragment, I can post it.</p>
  
  <p>Thank you in advance for your help! :)</p>