Hey there.
Let's go to our activity main layout file delete one of the buttons and constraints.
ALSO REMOVE THE on click method and then let's do this let's create an object of class bottom a variable
of class button
and here we will bind it to our layout
and set for this button on click listen as we once said that on click listen up for the spinner in music
shop application button not set on quickly center.
And here right New York click listen up and hear their own click method.
Then we check if media player is playing it has such a method and it return it returns true if it plays
and if it does not play then it returns false if it plays then we call the post method and a red line
is displayed here because we need to remove this view parameter since we removed the on click attributes.
Now we have a view on click listener that is attached to the button.
These parameters are not needed anymore here and here we write else.
That is if media player does not play then we call the play method to play.
Let's try it
coiled fun.
Everything is fine everything works well.
And now we need to change the text when Martin pressed when the order is play we need to display pause
here and when that order is post we need to display play.
This is done very simply.
We are in there are we in the play and pass methods.
The following court when the order is played pause should be displayed.
That's where we are right.
BARTON Not set text.
And here we specify the text we want to set let's write.
Pause and let's call this called pasted here.
Eve our audio on pause that we right here.
Play well let's see what happened.
Their audio plays and stops and the text changes as well.
Cool we got the right behavior.