I am struggling trying to google this subject. I must not being using the correct search terms. I have a location listener, in Android, and I usually nest the listener inside the class I am using it for.
public class ClassName {
...
private class Listener implements SomeListener{
...
public void somethingChanged(){
...
}
}
}
This time I decided to make the listener a new class to make the code easier to read and so I can reuse it. So now my listener and the class that is using the listener are separate.
public class ClassName{
...
}
public class Listener implements SomeListener{
...
public void somethingChanged(){
...
}
}
So inside the somethingChanged()
method, I just want to notify my main class that an event has occurred so I can do some updating. I can't think of a way to do this. I can't put anything specific in the listener's method or it is not reusable. How do I make a method that has been called from a Listener call a method in the class using the listener?