title: converting activity into fragment
body: <p>This is a simple code to play a sound on click off a <code>button</code>, this code was initially written in Activity but now i want to change it to Fragments. </p>
  
  <p>errors</p>
  
  <p>1) The method <code>setContentView(int)</code> is undefined for the type Rajathmusic.</p>
  
  <p>2) The method <code>create(Context, int)</code> in the type MediaPlayer is not applicable for the            arguments (Rajathmusic, int).</p>
  
  <p>3)The method <code>findViewById(int)</code> is undefined for the type Rajathmusic.</p>
  
  <p>I am just starting off with android development, any help would be appreciated!</p>
  
  <pre><code>public class Rajathmusic extends Fragment {
  
  private static final String TAG = "MyActivity";
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.activity_main);
  
      Log.v(TAG, "Initializing sounds...");
  
      final MediaPlayer mp = MediaPlayer.create(this, R.raw.rajath);
  
      Button play_button = (Button)this.findViewById(R.id.button3);
  
      play_button.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              Log.v(TAG, "Playing sound...");
              mp.start();
          }
      });
      Log.v(TAG, "Sounds initialized.");
  }}
  </code></pre>