Clicking button to play sound

InsanoLabs

New Member
I've looked through several answered questions on this website regarding my question but just cannot get this to work. I'm trying to make a button play a sound once it has been clicked.Java code:\[code\]package jg.AvengersSoundboard;import android.app.Activity;import android.os.Bundle;public class Activity2 extends Activity { private Object mp; /** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main2); }}\[/code\]XML Code:\[code\]<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent"android:background="#ffffff" ><Button android:id="@+id/button1" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Brain bag full of cats (HULK)"/><Button android:id="@+id/button2" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Do you think this madness will end in your rule? (THOR)" /><Button android:id="@+id/button3" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Freedom (LOKI)" /><Button android:id="@+id/button4" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Genius, Playboy, Billionaire. (STARK)" /><Button android:id="@+id/button5" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="I have an army, we have a Hulk. (STARK)" /><Button android:id="@+id/button6" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="I put a bullet in my mouth. (HULK)" /><Button android:id="@+id/button7" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="I&apos;m bringing the party to you (STARK)" /><Button android:id="@+id/button8" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Last time in Germany (Cpt. America)" /><Button android:id="@+id/button9" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Move away please" /><Button android:id="@+id/button10" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Submarine (HULK)" /><Button android:id="@+id/button11" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Tell me nobody kissed me (STARK)" /><Button android:id="@+id/button12" style="?android:attr/buttonStyleSmall" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="You mean peace" /> <Button android:id="@+id/Button02" android:layout_width="match_parent" android:layout_height="55px" android:text="Previous" android:textSize="18px" ></Button> \[/code\]
 
Back
Top