I\'m still trying to understand fragments and how they work. I have a fragment that inflates a layout. I am trying to play a sound when a button is pushed but I am coming ac
Use this code in onCreateView method of your fragment class and it will be working fine.
mp = MediaPlayer.create(getActivity, R.raw.songname);
Now you can call it's start method on your button click listener.
Make sure to make the MediaPlayer mp;
global for fragment class so you can use it afterwards.