There is a class that can be called from 4 places. There is a lisener in a class (lisener redefines from android libraries - its parameters cannot be changed). It is necessary to force this licer to work differently depending on who causes it. How can this be achieved?

Visualizer.setDataCaptureListener(bla, bla,bla) public void onFftDataCapture(Visualizer visualizer, byte[] fft, int samplingRate) {} 
  • Sorry, and you can more accurately specify the classes? What kind of listener? OnClick ... or OnChangeChecked ...? There are quite a few of them. - Lucky_spirit
  • Thanks, I thought about it, but decided to ask, suddenly there is another way, otherwise I can give something crooked. - Alexbelk

1 answer 1

Where do Visualizer come from? if they are created by you, then you can override the class, add a field with a tag there. In the lisener, cast the Visualizer from the parameters into your class and get the tag.