I wanna ask, I have a service inside which I have ...
# android
u
I wanna ask, I have a service inside which I have a HandlerThread, I instantiate a native C library, which is thread bound, in Service.onDestroy I need to release the library, but I need to do it on the handler thread. Is posting a message to the handler safe in onDestroy? I also need to quit the thread.
Copy code
override fun onDestroy() {
        super.onDestroy()
        handler.obtainMessage(ServiceHandler.MSG_CLOSE).sendToTarget()
        handlerThread.quitSafely()
    }
or should I not call super here, and call it from the msg_close callback, and also quit the handlerthread there?
stackoverflow 2