Reputation: 41
I have been following an online tutorial on how to play sound on button click. I am getting no errors with my Java code which leads me to believe that the code is correct.
However, they did not provide a tutorial on what the xml should read. So I left it as it is but when the Activity
loads nothing is occuring and I'm left with the Hello World Template.
Could somebody advise me how to get this code to run in the view and if so how. If not could they maybe provide me with an alternate option.
Upvotes: 1
Views: 403
Reputation: 3578
Currently in your XML you have a TextView, you should add a Button (actually you can just change TextView to Button in this case). After that you need to either add
android:onClick="onClick"
under the button.
Or you can use a onClickListener for the button.
Upvotes: 1