Basic Java and button sound (Help)

Hi guys.
I’ve got 2 questions, stupid, but really grinds my gears that i can figure it out so I just ask you more experienced guys:

  1. In every video about eclipse, people have just a few lines of code in so why in the world do I have this ?
package com.example.sasa;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;

public class MainActivity extends ActionBarActivity {

    protected void onCreate(Bundle savedInstanceState) {

        if (savedInstanceState == null) {
                    .add(, new PlaceholderFragment())

    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(, menu);
        return true;

    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == {
            return true;
        return super.onOptionsItemSelected(item);

     * A placeholder fragment containing a simple view.
    public static class PlaceholderFragment extends Fragment {

        public PlaceholderFragment() {

        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main, container, false);
            return rootView;


So why do I have “if” there and all the booleans. And what does it all mean ?

  1. How do I set onClickListener for multiple buttons and make them play various sounds (each button different sound) when clicked, without going to other activity (saw it in a tutorial done this way) ?

Somebody please help me, thanks :slight_smile: