samedi 19 septembre 2015

Trying to make check box mute music

Im pretty new and this is what I have so far im confused on how to make the check box mute this is what I have so far. FYI I am learning about dialog boxes, buttons, checkboxes now. I just recently learned how to add music that was an ordeal so any help is appreciated!

public class DialogBox extends Activity implements View.OnClickListener
{
    MediaPlayer mySound;

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

        Button one = (Button)findViewById(R.id.btn);
        one.setOnClickListener(this);
        mySound = MediaPlayer.create(this,R.raw.mario);
    }
    @Override
    public void onClick(View v)
    {
        switch (v.getId())
        {
            case R.id.btn:
              mySound.start();
                break;
        }
}




Aucun commentaire:

Enregistrer un commentaire