I currently have a class that takes in the location of the object(so arguments keep changing), and I am initializing the class and running a function from the class every second in a thread, it returns an integer(-1 if doesn't exist or error). The integer that function returns is important because based on that integer, I will run a few other functions that will run on separate threads as well. Is there a way to convert all that process to using an Event Listener?
I basically want the event to trigger when the function in that class returns any number other than -1 and then I would run a separate thread with some functions from the MainActivity.
I looked at some other threads like Android Custom Event Listener, that was helpful to give me a good idea on how to do it, but I am not sure if it's possible to do it in my case and I tried doing what they said but it didn't work.