Audio Can';在切换按钮上无法获得自定义声音

Audio Can';在切换按钮上无法获得自定义声音,audio,toggle,Audio,Toggle,试图让我的切换按钮产生定制的声音,但我就是做不到,我对eclipse非常陌生,我设法在启动屏幕上获得了它,但无法为按钮获得它 package org.iimed.www; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import an

试图让我的切换按钮产生定制的声音,但我就是做不到,我对eclipse非常陌生,我设法在启动屏幕上获得了它,但无法为按钮获得它

package org.iimed.www;

import android.media.MediaPlayer;
import android.os.Bundle;

import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.ToggleButton;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;

public class vpbox extends Activity {


   private ImageButton home;




    public void onCreate(Bundle vpbox_activity) {
         super.onCreate(vpbox_activity);
        setContentView(R.layout.vpbox_activity);

        tuetoggle = (ToggleButton) findViewById(R.id.tuetoggle);

    home = (ImageButton) findViewById(R.id.home);

        home.setOnClickListener(new OnClickListener(){

            @Override
            public void onClick(View v){

                startActivity(new Intent(vpbox.this, MainActivity.class));




      ToggleButton sb = (ToggleButton) findViewById(R.id.suntoggle);
       sb.setText(null);
       sb.setTextOn(null);
      sb.setTextOff(null);
       sb.setBackgroundResource(R.drawable.vpbuttons);


        ToggleButton mt=  (ToggleButton)findViewById (R.id.montoggle);
        mt.setText(null);
        mt.setTextOn(null);
        mt.setTextOff(null);
        mt.setBackgroundResource(R.drawable.vpmonday);


    ToggleButton wt = (ToggleButton) findViewById(R.id.wedtoggle);
    wt.setText(null);
    wt.setTextOff(null);
    wt.setTextOn(null);
    wt.setBackgroundResource(R.drawable.vpwed);



    ToggleButton ft =  (ToggleButton) findViewById(R.id.fritoggle);
    ft.setText(null);
    ft.setTextOn(null);
    ft.setTextOff(null);
    ft.setBackgroundResource(R.drawable.vpfri);
带有声音的测试按钮:

    ToggleButton thb =  (ToggleButton) findViewById(R.id.thutoggle);
    thb.setText(null);
    thb.setTextOn(null);
    thb.setTextOff(null);
    thb.setBackgroundResource(R.drawable.vpthu);
    MediaPlayer mp= MediaPlayer.create(getBaseContext(), R.raw.splashsound);
    mp.start();

我们在说什么语言?爪哇?是的,爪哇。准确地说是Eclipse。所以我用了一个按钮,但我有七个按钮来发出声音,不幸的是,它似乎不像为每个按钮重复相同的代码那样简单,我显然缺少某些括号等。