This is a simple code to play a sound on click off a button, this code was initially written in Activity but now i want to change it to Fragments.
button
erro
Copy the code from the onCreate() method from the activity and paste it into the onCreateView() method of the fragment.
onCreate()
onCreateView()
To fix the errors, pass getActivity in place of this keyword and use getView().findViewById().
getActivity
getView().findViewById()