title: Child fragment from onListItemClick within viewPager behaves unexpectedly
body: <p>I have 3 ListFragments being handled by a viewPager (managed by a FragmentAdapter) - they work perfectly. Now when the user clicks an item in ListFragment #1, a new Fragment should open with the details. It's behaving strangely in the following manner:</p>
  
  <ol>
  <li><p>Only clicking a list item twice opens the DetailFragment, yet debugging shows the first click indeed goes into the DetailFragment, but doesn't show the view (the view still shows the current ListFragment).</p></li>
  <li><p>After clicking the 2nd time, the DetailFragment does show it's layout, but not the elements within it (like TextView, etc).</p></li>
  <li><p>If the user 'accidently' swipes the screen when DetailFragment is showing, the viewPager sets it in place of the 2nd ListFragment! Only when pressing back on the DetailFragment view will 'reset' the viewPager to it's correct ListFragment. Of course if the user swipes when in a DetailFragment, the next ListFragment of the viewPager should appear, and the DetailFragment should be removed.</p></li>
  </ol>
  
  <p>Thanks for any tips muddling through Android's odd world of fragments and views :)</p>
  
  <pre><code>public class PlanetFragment extends ListFragment{
  
      LayoutInflater inflater;
      ListView list;
      ArrayList&lt;HashMap&lt;String, String&gt;&gt; planetListArray;
  
      HashMap&lt;String, String&gt; planetMap;
      Activity activity;
      Context context;
  
         @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
              View v = inflater.inflate(R.layout.planets_tab_layout, container, false);
              inflater=(LayoutInflater)getLayoutInflater(savedInstanceState);
              activity = getActivity();
              context = PlanetFragment.this.getActivity();
              String dbTableName = "Table_Planets";
              SQLiteHelper info = new SQLiteHelper(getActivity().getBaseContext());       
              info.open();
  
              ArrayList&lt;HashMap&lt;String, String&gt;&gt; datafromSQL = info.getData(dbTableName);
  
              if(!datafromSQL.isEmpty()){ 
                  planetListArray = new  ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
                  for (int i = 0; i&lt;datafromSQL.size(); i++){
  
                      planetMap = new HashMap&lt;String, String&gt;();
                      planetMap.put(PLANET_ID, datafromSQL.get(i).get(KEY_PLANET_ID));
                      planetMap.put(ZODIAC_ID, datafromSQL.get(i).get(KEY_ZODIAC_ID));
                      planetMap.put(DEGREES, datafromSQL.get(i).get(KEY_DEGREES));
                      planetMap.put(CONTENT, datafromSQL.get(i).get(KEY_CONTENT));
  
                      planetListArray.add(planetMap);              
                  }   
                  info.close();
              }
  
            list = (ListView) v.findViewById(android.R.id.list); 
            PlanetAdapter adapter=new PlanetAdapter(getActivity(), R.layout.planets_row, planetListArray); 
            list.setAdapter(adapter);
  
            return v;
         }
  
         @Override
          public void onViewCreated(View view, Bundle savedInstanceState) {
              super.onViewCreated(view, savedInstanceState);
              //the dividers 
              getListView().setDivider(getResources().getDrawable(R.drawable.purplebartop));
          }
  
      @Override
          public void onListItemClick(ListView l, View v, int position, long id) {
              super.onListItemClick(l, v, position, id);
              HashMap&lt;String, String&gt; item = planetListArray.get(position);
  
              Bundle bundle = new Bundle();
              bundle.putSerializable("itemMap", item);
              bundle.putInt("position", position);
              Fragment frag = DetailFragment.newInstance();
              frag.setArguments(bundle);
              if (frag != null) {
                  getActivity().getSupportFragmentManager()
                      .beginTransaction()
                      .replace(R.id.pager, frag, "frag")
                      .addToBackStack("frag")
                      .commit();
              }
          }
  }
  
  
  
  public class DetailFragment extends Fragment{
  
      Context context;
      Activity activity;
      TextView planetName;
  
      public static android.support.v4.app.Fragment newInstance() {
          DetailFragment f = new DetailFragment();
          return f;
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
  
          inflater=(LayoutInflater)getLayoutInflater(savedInstanceState);
          View v = inflater.inflate(R.layout.dialog_details, container, false);
          activity = getActivity();
          context = DetailFragment.this.getActivity();
          planetName = (TextView)v.findViewById(R.id.planetNameExpanded);
          planetName.setText("planetX");
  
          return v;
      }
  }
  </code></pre>
  
  <p><strong>EDIT:</strong>
  Instead of <code>getActivity().getSupportFragmentManager()</code> I have also tried <code>getChildFragmentManager()</code>  but it always gives the error: The method <code>getChildFragmentManager()</code> is undefined for the type PlanetFragment.</p>