title: Switching from TabHost to Fragments with Viewpager: Where to put all my Code
body: <p>Until now I've used <code>TabHost</code> for my App to create 3 Tabs. Each Tab is represented by an Activity in which I get the layout via <code>setContentView(R.layout.something)</code> from an XML file.
  So 3 Tabs, 3 Activities and 3 XML files.</p>
  
  <p>Now I've stumbled upon fragments, which are the new and better way to go, so here is my question.</p>
  
  <p>Fragments handle the UI, so create 3 Fragments which are handled by <code>FragmentPagerAdapter</code>. Inside each Fragment I create the Content via XML files.</p>
  
  <p>But where do I put all the code about which button does what, read from database or write to it etc. So far that's all been in each Activity that was loaded by the <code>Tabhost</code>.</p>
  
  <p>Do I put all that code into the <code>onCreate()</code> etc. methods of each fragment or is there a better and cleaner way to do it?</p>