mardi 19 mai 2015

How to add multple buttons from one activity to an a different to activity in android

I would like for onClick to remain playing the sounds. However I want to have an activity with all my favorite sounds, therefore placing the respected sound in a "favorties" activity upon a long click. Also which it will play in the "favorties" activity and save the favorites.

    button1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            player = MediaPlayer.create(MainActivity.this, R.raw.sound1);
            player.start();
        }
    });

    button2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            player = MediaPlayer.create(MainActivity.this, R.raw.sound2);
            player.start();
        }
    });

Aucun commentaire:

Enregistrer un commentaire