I know there are a lot of similar threads but I\'ve gone through them and still can\'t figure out the problem. My program reaches the Handler but it always returns the catc
For future reference, I had multiple fragments, one for each tab in my ViewPager. One TextView had the same id
in two fragments and that created a conflict. I didn't realize I had the same id
so everything seemed fine, no error message, but the text simply didn't change. Therefore I'd recommend using unique names for the id
.
In my case, I found there are a TextWatcher
and a Filter
linked to my Textview
, which both contain a logic that prevents the updating of my Textview
value.
So additionally to other solutions, you can check if your Textview
is linked to any TextWatcher
or Filter
and then trace it.
You haven't given us much to go on.
You should look at the exception stack trace, instead of printing a message to the console: e.printStackTrace();
But from here, if I had to guess, it looks like you're either setting the TextView's text off the main thread, or - and which appears unlikely based on what you've posted - your TextView has not been set and you have a null pointer exception.
just like this is ok!
private void setUpViews() {
chatbox = (TextView) findViewById(R.id.chatbox);
chatbox.setText("Got it!");
}
when the textColor is the same as View's background color ,the text also sees invisible ,so you can define a textColor to solve it
have you send a message? for example:
Message message=new Message();
message.what=1;
mHandler.sendMessage(message);