Nat Thomas

Greenhorn
+ Follow
since Aug 20, 2017
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nat Thomas

Nat Thomas wrote:

Norm Radder wrote:Is there just one handler variable that is being used?  Hard to tell with the code snippets.

Where is the code that causes the run method to be called?



Yes, just the one.



The code that causes the run method to be called is just above your post.
6 years ago

Norm Radder wrote:Is there just one handler variable that is being used?  Hard to tell with the code snippets.

Where is the code that causes the run method to be called?



Yes, just the one.
6 years ago
This method is called here:

6 years ago

Norm Radder wrote:Where is the code that will cause the  handleMessage method to be called?



It's "handler.sendEmptyMessage(0);" in this method:


6 years ago
So basicallly I found out that my handler works if I simply want to send out a Toast message. So the problem is actually not with the handler itself.
The problem is this:



This works (first five letters turn to black) but :



This doesn't work (first five letters remain white).

Do you have any ideas what might be the problem?
Thanks!
6 years ago
I have a method that checks in realtime whether words exists:



This method, checkIfExists(), looks like this:



The problem is that my TextView is inside onBindViewHolder, and the only way I can access it to change it is by putting my handler inside onBindViewHolder too.

I hope this makes more sense now.
6 years ago

Nat MadHatter wrote:

Norm Radder wrote:

nothing happens when "handler" is called.


handler is a reference to an object, not a method that can be called.  Please explain what method you are trying to call and why you think that method is not being called.



Hi again, and thanks for your help.

I use "handler.sendEmptyMessage(0);" in another method. Technically, my TextView should turn to black as soon as Handler is called, but this does not happen.

Do you need me to provide more code or am I making sense?



Oh, sorry, I've just realized I already gave that info earlier on. Let me try and explain better what I mean.
6 years ago

Norm Radder wrote:

nothing happens when "handler" is called.


handler is a reference to an object, not a method that can be called.  Please explain what method you are trying to call and why you think that method is not being called.



Hi again, and thanks for your help.

I use "handler.sendEmptyMessage(0);" in another method. Technically, my TextView should turn to black as soon as Handler is called, but this does not happen.

Do you need me to provide more code or am I making sense?

6 years ago
If I declare the variable "handler" with other variables at the top, below the class name, the app compiles but nothing happens when "handler" is called.

One other possibility would be if I could refer to MyViewHolder (holder) outside of OnBindViewHolder. Then I would not need to put my Handler in OnBindViewHolder. Is this possible?
6 years ago
Hello, I have a handler in my onBindViewHolder method which looks like this:



I am trying to call it from another method using: handler.sendEmptyMessage(0);
But symbol "handler" cannot be resolved.

I tried creating a field for "handler" but this is not useful.

How can I connect my handler to my method?
6 years ago