title: Android - Multiple activities under a single tab, Fragments
body: <p>After scanning all the related questions regarding multiple activities under one tab, I found out that they all refer to using ActivityGroup which is <strong>deprecated</strong>.</p>
  
  <p>Basically I have 2 tabs, the first one contains a main activity with several buttons and when button is clicked 1 for instance a new activity should open under the same tab, clicking back should bring me to the main view under the first tab. The second tab contains only one activity.</p>
  
  <p>Tried inflating a new view for the sub-activities:</p>
  
  <pre><code>FrameLayout frameLayout = tabHost.getTabContentView();
  frameLayout.removeAllViews();
  View view = getLayoutInflater().inflate(layoutID, tabHost, false);
  frameLayout.addView(view);
  </code></pre>
  
  <p>But I only get the view, I cannot handle it like an activity; meaning adding buttons or listeners, it's only a view.</p>
  
  <p>Google suggests using <strong>fragments</strong> instead, but I am having the hard time implementing this. Maybe replacing the activities with fragments could be the solution.</p>
  
  <p>I could really use a good tab\fragments example right about now...</p>
  
  <p>Any suggestions? Thanks in advance.</p>