title: Navigation In Android Fragments
body: <p>I tried with Fragments with tabs. I have three tabs in my application,FragA, FragB, FragC.
  In FragA Class I have a button. If I clicked the button, then want to navigate to the Class FragNew. How can I do this..</p>
  
  <p>Here is my FragA Class: </p>
  
  <pre><code>public class AFragment extends Fragment {
  
      Button next;
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          View view = inflater.inflate(R.layout.afragment, container, false);
          next = (Button)view.findViewById(R.id.button1);
  
          next.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  Toast.makeText(getActivity(), "FragmentA Clicked...", Toast.LENGTH_SHORT).show();
              }
          });
  
          return view;
  
      }
  
  }
  </code></pre>
  
  <p>afragment.xml:</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:background="#85ff34"
      android:orientation="vertical" &gt;
  
      &lt;TextView android:id="@+id/textView1"
          android:text="Fragment A"
          android:textColor="#000000"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"/&gt;
  
      &lt;Button
          android:id="@+id/button1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Next" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>and My FragNew Class is: </p>
  
  <pre><code>public class FragNew extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          // Inflate the layout for this fragment
          return inflater.inflate(R.layout.bfragment, container, false);
      }
      }
  </code></pre>
  
  <p>Here is the View of my requirement: </p>
  
  <pre><code>MainTabActivity
    ActivityInTab1
      Fragment1 -&gt; Fragment2 -&gt; Fragment3
    ActivityInTab2
      Fragment4
    ActivityInTab3
      Fragment5 -&gt; Fragment6
  </code></pre>
  
  <p>How can I do the Navigation between FragA to FragNew with Maintain the Tabs like TabGroup Activity.</p>