I have an endless thread running in my code. This thread creates UDP read methods and listens on the connection endlessly.
What I want to do is to execute a piece of code once I stop the thread execution manually (by clicking the stop button in eclipse).
Is their a possible way of achieving this ?
While searching the same I came across a onDestroy() method but sadly that is applicable for Android Java only !!!