I have my main activity and I have a service (which runs even in the background when the app is closed). I would like to be writing to the same file from the activity AND from the service. what would be the right way to achieve this (design wise)?
One solution is to have a global variable to tell me if the service is currently writing or if the Activity is doing it ( so I dont end up openning the file twice). Another way is bind the service to the activity and the activity can only write to file by calling a method on the service
Any idea is appreciated
Thanks