Update textView from thread

In my OnCreate method I have created a thread that listens to incoming message!

In OnCreate() {

//Some code

myThread = new Thread() {

            @Override

            public void run() {

                receiveMyMessages();

            }
        };
myThread.start();

// Some code related to sending out by pressing button etc.

}

Then, receiveMyMessage() functions…

Public void receiveMyMessage()
{

//Receive the message and put it in String str;

str = receivedAllTheMessage();

// <<    here I want to be able to update this str to a textView. But, How?
}

I checked this article but it did not work for me, no luck!

9
задан halfer 15 April 2017 в 21:36
поделиться