your button actually have reference problem you just need to call findviewbyid method from the layout which you have inflated for popup, like this:--
Button cancel = (Button) layout.findViewById(R.id.back_music);
cancel.setOnClickListener(onCancelClick);