title: Play sound on button click android
body: <p>How do I get a button to play a sound from raw when click? I just created a button with id <code>button1</code>, but whatever code I write, all is wrong.</p>
  
  <pre><code>import android.media.MediaPlayer;
  
  public class BasicScreenActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_basic_screen);
      }
  
      Button one = (Button)this.findViewById(R.id.button1);
      MediaPlayer = mp;
      mp = MediaPlayer.create(this, R.raw.soho);
      zero.setOnCliclListener(new View.OnClickListener() )
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.basic_screen, menu);
          return true;
      }
  
  
  
  }
  </code></pre>