Skip to content Skip to sidebar Skip to footer

Can You Set Textview Text Within A Thread?

What I need it to have it once the app stops reciving text from the server saying that it is now disconected I need to set the button to say that it is disconnected, this is what I

Solution 1:

Use runOnUiThread or a handler to make changes to UI from a thread.. I think this line is causing the error..

Connect.setBackgroundResource(R.drawable.contect_button);

put it in runOnUiThread in your thread like this

       runOnUiThread(new Runnable() {
                     public void run() {

                        Connect.setBackgroundResource(R.drawable.contect_button);
                    }
                });

Post a Comment for "Can You Set Textview Text Within A Thread?"