You do not need to overload or try to do any kind of cover between String and Message . What you have to do is put this String in an object of type Message and send it to Handler . Then, in handleMessage() extract the string from the message.
Something like that:
And in handleMessage() :
@Override public void handleMessage(Message msg) { String message = (String) msg.obj;
But besides this, the program has a problem: you cannot send data to the handler, because this part of the code is not available:
while (true) { WifiInfo s = wifiManager.getConnectionInfo(); //.. } String message = "linkSpeed = " + linkSpeed; // This line never won't be reached.
Also, be sure to stop Thread at some point, otherwise it will continue to work even after you close the application.
source share