Play sound on button click android
tried many tutorials, youtube, stackoverflow, none work :(
help me please to get the button play a sound from raw when click. I just
created a button with id button1, and what code I write all is wrong. :(
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;
}
}
No comments:
Post a Comment