title: Button in tab fragment
body: <p>I was following tutorials on how to make Tabs using fragments.
  each tab has this in the java files:</p>
  
  <blockquote>
    <p>public class rdfri extends Fragment {</p>
  </blockquote>
  
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      if (container == null) {
          // We have different layouts, and in one of them this
          // fragment's containing frame doesn't exist.  The fragment
          // may still be created from its saved state, but there is
          // no reason to try to create its view hierarchy because it
          // won't be displayed.  Note this is not needed -- we could
          // just run the code below, where we would create and return
          // the view hierarchy; it would just never be used.
          return null;
      }
     return (LinearLayout)inflater.inflate(R.layout.rdfri, container, false);
  }
  </code></pre>
  
  <blockquote>
    <p>}</p>
  </blockquote>
  
  <p>I would like to try and get a imageButton in the fragment. I figured image bottons work with this code:</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.rdmon);
  </code></pre>
  
  <blockquote>
    <p>ImageButton rainbowbook = (ImageButton) findViewById(R.id.imageButton1);</p>
  </blockquote>
  
  <pre><code>    rainbowbook.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View view) {
  
              Intent myIntent = Intent(rdmon.this, RainbowBookActivity.class);
              rdmon.this.startActivity(myIntent);
          }
      });
  </code></pre>
  
  <blockquote>
    <p>}</p>
  </blockquote>
  
  <p>So how would I go about getting the button code in the fragment code?</p>
  
  <p>Thanks.</p>