title: How to run code on a button click in android fragment
body: <p>I need help trying to make a app work. I set up a multitab interface using fragments(so it there are 4 tabs with diffrent contents) On the fragment i am working on i want to have 3 buttons which run a intent like this:</p>
  
  <pre><code>    Log.i(TAG, "Website Clicked");
              Intent websiteBrowserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://stackoverflow.com/"));
              startActivity(websiteBrowserIntent);
  </code></pre>
  
  <p>So i have 3 buttons, heres the .xml:</p>
  
  <p>XML does not seem to work for some reason heres a pastebin:
  <a href="http://pastebin.com/gGuh7qb2" rel="nofollow">http://pastebin.com/gGuh7qb2</a></p>
  
  <p>And here is TopRatedFragment.java:</p>
  
  <pre><code>package com.bordengrammar.bordengrammarapp;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  public class TopRatedFragment extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
  
          View rootView = inflater.inflate(R.layout.fragment_top_rated, container,         false);
  
          return rootView;
      }
  }
  </code></pre>