title: Two ListFragment inside one Fragment
body: <p>I have created following thing in android using android  compatibility support package</p>
  
  <p><img src="https://i.stack.imgur.com/QLwIg.png" alt="enter image description here"></p>
  
  <p>Basically i have a FragmentAcitivity which shows two Tabs. One Tab represents <code>Fragment #1</code> and second is <code>Fragment #2</code>. Fragment #2 has two ListFragment i.e. ListFragment #1 and ListFragment #2 , but the problem is m i am getting following error when i try to do that.</p>
  
  <pre><code>    android.view.InflateException: Binary XML file line #10: Error inflating class fragment
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:582)
       at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
       at com.myexample.template.TextVoiceFragment.onCreateView(TextVoiceFragment.java:19)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:837)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1041)
       at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:616)
       at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1359)
       at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:422)
       at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:86)
       at android.support.v4.view.ViewPager.populate(ViewPager.java:453)
       at android.support.v4.view.ViewPager.onAttachedToWindow(ViewPager.java:563)
       at android.view.View.dispatchAttachedToWindow(View.java:6015)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:1124)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:1129)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:1129)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:1129)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:1129)
       at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:1129)
       at android.view.ViewRoot.performTraversals(ViewRoot.java:731)
       at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:143)
       at android.app.ActivityThread.main(ActivityThread.java:4914)
       at java.lang.reflect.Method.invokeNative(Native Method)
       at java.lang.reflect.Method.invoke(Method.java:521)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
       at dalvik.system.NativeStart.main(Native Method)
   Caused by: java.lang.IllegalStateException: Content view not yet created
       at android.support.v4.app.ListFragment.ensureList(ListFragment.java:328)
       at android.support.v4.app.ListFragment.getListView(ListFragment.java:222)
       at com.myexample.template.VoiceTemplate.onActivityCreated(VoiceTemplate.java:82)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:858)
       at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1020)
       at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1099)
       at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:263)
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:558)
  </code></pre>
  
  <p><strong><em>Binary XML</em></strong> </p>
  
  <pre><code>&lt;fragment class="com.myexample.template.VoiceTemplate" 
      android:id="@+id/voiceListFragment"
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_weight="1" 
  /&gt;
  </code></pre>
  
  <p><strong><em>Line number 19 contains</em></strong> inside onCreateView of TextVoiceFragment.class which is Fragment #2 in this case</p>
  
  <pre><code> return inflater.inflate(R.layout.text_voice_fragment, container, false);
  </code></pre>
  
  <p><strong><em>Line number 82 contains</em></strong> in code inside onActivityCreated of VoiceTemplate.class which extents ListFragment &amp; a ListFragment #2</p>
  
  <pre><code>// 
  getListView().setOnItemClickListener( new OnItemClickListener(){
  
      @Override
      public void onItemClick(AdapterView&lt;?&gt; adapterView, View view,
              int position, long arg3) {
          // TODO Auto-generated method stub
      }
  
   });
  </code></pre>
  
  <p>i have tried replacing Fragment #2 with FragmentActivity as follows </p>
  
  <p><img src="https://i.stack.imgur.com/V6nj9.png" alt="enter image description here"></p>
  
  <p>but in that case i am getting following error</p>
  
  <pre><code> java.lang.ClassCastException: com.myexample.template.TextVoiceFragment 
  </code></pre>
  
  <p>here TextVoiceFragment is Tab second </p>