Android 媒体播放器无法使用按钮

Android Media Player not Working with Buttons

我的 MediaPlayer 不工作。我有 9 个按钮和 9 首歌曲。一首歌曲是一个按钮。所有按钮都不起作用!抱歉我的英语不好,我来自德国 这是我的代码:

import android.media.MediaPlayer;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;


public class MainActivity extends ActionBarActivity {

    private Toolbar toolbar;
    MediaPlayer achieve;
    MediaPlayer iyo;
    MediaPlayer krankelache;
    MediaPlayer mannarzt;
    MediaPlayer missgeburt;
    MediaPlayer mutterfinden;
    MediaPlayer omg;
    MediaPlayer scheisse;
    MediaPlayer twocups;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //MediaPlayer
        this.achieve = MediaPlayer.create(this, R.raw.achieve);
        this.iyo = MediaPlayer.create(this, R.raw.iyo);
        this.krankelache = MediaPlayer.create(this, R.raw.krankelache);
        this.mannarzt = MediaPlayer.create(this, R.raw.mannarzt);
        this.missgeburt = MediaPlayer.create(this, R.raw.missgeburt);
        this.mutterfinden = MediaPlayer.create(this, R.raw.mutterfinden);
        this.twocups = MediaPlayer.create(this, R.raw.twocups);
        this.omg = MediaPlayer.create(this, R.raw.omg);
        this.scheisse = MediaPlayer.create(this, R.raw.scheisse);

        //Toolbar
        toolbar= (Toolbar) findViewById(R.id.app_bar);
        setSupportActionBar(toolbar);
    }
....

谢谢

import android.media.MediaPlayer;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;


public class MainActivity extends ActionBarActivity {

    private Toolbar toolbar;
    MediaPlayer achieve;
    MediaPlayer iyo;
    MediaPlayer krankelache;
    MediaPlayer mannarzt;
    MediaPlayer missgeburt;
    MediaPlayer mutterfinden;
    MediaPlayer omg;
    MediaPlayer scheisse;
    MediaPlayer twocups;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //MediaPlayer
        this.achieve = MediaPlayer.create(this, R.raw.achieve);
        this.iyo = MediaPlayer.create(this, R.raw.iyo);
        this.krankelache = MediaPlayer.create(this, R.raw.krankelache);
        this.mannarzt = MediaPlayer.create(this, R.raw.mannarzt);
        this.missgeburt = MediaPlayer.create(this, R.raw.missgeburt);
        this.mutterfinden = MediaPlayer.create(this, R.raw.mutterfinden);
        this.twocups = MediaPlayer.create(this, R.raw.twocups);
        this.omg = MediaPlayer.create(this, R.raw.omg);
        this.scheisse = MediaPlayer.create(this, R.raw.scheisse);

        //Toolbar
        toolbar= (Toolbar) findViewById(R.id.app_bar);
        setSupportActionBar(toolbar);
    }
....