I have an Android Service which updates a notification every second using this Thread (comments are not really relevant):
thread = new Thread() { @Overri
In finally block you can do the following thing
finally { try { freeOut.close(); } catch (IOException e) { e.printStackTrace(); }