H
H
HolidayR2018-09-10 13:33:59
Java
HolidayR, 2018-09-10 13:33:59

How to stop an AudioPlayer that is in another class?

Good afternoon!
AudioPlayer playback is turned on in the fourth class, then I return to the second one, the audio recording also plays, it is necessary to disable ( Stop()) the playback of the audio recording when the button in the second class is pressed.
The procedure itself is clear as day (at least it seems to me). I do the import of the fourth class, then through ЧетвертыйКласс.stop();the method of stopping the audio recording from the fourth class, BUT an error pops up about

"Non-static method 'stop()' cannot be referenced from a static contexе"

It would seem clear, but how can it be bypassed without changing it static?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2018-09-10
@Div100

"in the fourth grade, in the second"

Tip: if you have some thought or problem in your head, and you put it in a "few words", it does not mean at all that those who read your presentation of the thought will see the same thing that you see. Just not enough context that you have.
On a subject:
Your class should be able to operate this object for a start. When you call the stop() method, the class must already be initialized with this object that plays the audio recording, then it can stop it.
Therefore, if this is not your case, either write the code, post it, or formulate the question more clearly. Good luck!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question