2

I want to stop the background music when user clicks on the exit button and direct to the main screen. What is missing in the code below?

public void addListenerOnButton() {

        final Context context = this;

        exitButton = (Button) findViewById(R.id.exit);

        exitButton.setOnClickListener(new View.OnClickListener() {

        @Override

        public void onClick(View v) {

                Intent intent = new Intent(context,Games.class);

                startActivity(intent);

                player.stop();

                player.release();




        }
    });

}
Mirco
  • 2,940
  • 5
  • 34
  • 57
darshfify
  • 95
  • 8

0 Answers0