The service in my app cant be always active, so i call startService() when i need and after that, i call stopService().
But sometimes, when (in rare cases) the user uses some features of my application, the service can be started and stopped several times. I wonder if there is any performance issue with this (starting and stopping the service several times), because in the emulator works fine. There is a better way of doing this?
If you’re using the service to run short tasks and then immediately stop, why not check out AsyncTask?
The on{Pre,Post}Execute() methods are also useful for interacting with your UI thread based on the inputs/results to the AsyncTasc.