I have a service that is in a different java file than the file that is starting the service.
Let's call one Main.java and one ServiceFile.java for simplicity.
Main starts the service(ServiceFile.java) in onCreate() and the service continues running for the life of the application. The function of the service is to perform network operations on a separate thread and then after receiving data, creates a Vehicle object.
I need to get this object from the ServiceFile.java to Main.java
I have read about Handlers on the google devs and it seems like what I need. However, all examples that I can find of implementation of Handlers are ones where other threads are in the same java file. How do I sendMessage across files like this?
I had the idea of using putExtra to give a reference to the Handler but that wouldn't work because Handler isn't parcelable or serializable.