I'm new in android app coding, and I am facing a question.
MainActivity has a navigationView, which links with different classes
A class I called "Station", so it will call like this
myFragment = new Station();
Station class extends Fragment, I used it to create fragments named
- Station_General_Fragment
- Station_ER_Fragment
- Station_WR_Fragment
MainActivity also has a MediaPlayer (I call it mp1), and I'm trying to do OnCompletionListener for mp1, each fragment does different things in OnCompletionListener
The trouble I am facing is
Different OnCompletionListener in different classes mess up each other
What I am trying to do is
- Get what fragment the activity is viewing
- Compare with the fragment that OnCompletionListener located at
- If equals, then do the code inside OnCompletionListener of that fragment
Anyone can help me? I can explain more if anyone wanna help me but don't know what I am talking about. Thank You