The following Function is executing in its own thread:
private void doSendData() { try { //writeToFile(); // just a temporary location of a c
I always cringe when I see this kind of code. Do yourself a favour and have a look at the java.util.concurrent package.
java.util.concurrent