In the Observer pattern, an event handler is the function or method called on an observer listening for an event dispatched by the subject. Also known as an event listener.
Questions tagged [handler]
3718 questions
78
votes
4 answers
How to create a Looper thread, then send it a message immediately?
I have a worker thread that sits in the background, processing messages. Something like this:
class Worker extends Thread {
public volatile Handler handler; // actually private, of course
public void run() {
Looper.prepare();
…

Thomas
- 174,939
- 50
- 355
- 478
78
votes
4 answers
How to remove a runnable from a handler object added by postDelayed?
I have an "open" animation and am using Handler.postDelayed(Runnable, delay) to trigger a "close" animation after a short delay. However, during the time between open and close, there is possibly another animation triggered by a click.
My question…

Bruce Lee
- 3,049
- 3
- 20
- 13
71
votes
6 answers
No handlers could be found for logger
I am newbie to python. I was trying logging in python and I came across No handlers could be found for logger error while trying to print some warning through logger instance. Below is the code I tried
import…

qwerty
- 2,392
- 3
- 30
- 55
68
votes
12 answers
Android - Hold Button to Repeat Action
I'll admit straight off that I'm new to development and trying my hand at Android. I've been trying to search the 'net to find advice on how to implement some "Hold Button to Repeat Action" - I've created a custom numpad from buttons and want a…

Mark
- 797
- 1
- 6
- 7
67
votes
4 answers
TimerTask vs Thread.sleep vs Handler postDelayed - most accurate to call function every N milliseconds?
What is the most accurate way to call a function every N milliseconds?
Thread with Thread.sleep
TimerTask
Handler with postDelayed
I modified this example using Thread.sleep and it's not very accurate.
I'm developing a music app that will play…

fxfuture
- 1,910
- 3
- 26
- 40
66
votes
8 answers
Custom Events Model without using DOM events in JavaScript
I'm new to JavaScript and programming in general, and I have some questions about objects and events.
Say I have an object:
var computer = {
keyboard: {}
}
What I'm looking for is a way to register events to the keyboard…

NTDave
- 663
- 1
- 6
- 5
62
votes
4 answers
JavaFX: Stage close handler
I want to save a file before closing my JavaFX application.
This is how I'm setting up the handler in Main::start:
primaryStage.setOnCloseRequest(event -> {
System.out.println("Stage is closing");
// Save file
});
And the controller calling…

Heine Frade
- 723
- 1
- 5
- 4
61
votes
5 answers
what is this "scheme don't have a registered handler" error?
I am working on a node app.
i have an ejs file , where on clicking a button a get request is made to this url localhost:3000/posts/business-economics
but the page doesn't load up and this error is shown in the console
Failed to launch…

Ritish Gupta
- 761
- 1
- 5
- 8
61
votes
3 answers
java.lang.RuntimeException: Handler (android.os.Handler) sending message to a Handler on a dead thread
in my app I'm using IntentService for sending SMS.
@Override
protected void onHandleIntent(Intent intent) {
Bundle data = intent.getExtras();
String[] recipients = null;
String message = getString(R.string.unknown_event);
String…

eyal
- 2,379
- 7
- 40
- 54
59
votes
5 answers
Why to use Handlers while runOnUiThread does the same?
I have come across both Handlers and runOnUiThread concepts. But to me it still seems to be a doubt as on which facts do they differ exactly.
They both are intended to do UI actions from a background thread. But what are the factors that are to be…

Andro Selva
- 53,910
- 52
- 193
- 240
52
votes
6 answers
CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch views
I have an issue with the following error in Android:
CalledFromWrongThreadException;: Only
the original thread that created a
view hierarchy can touch its views
It appears to happen when I try to update a Textview in my Activity, the call to…

Donal Rafferty
- 19,707
- 39
- 114
- 191
51
votes
16 answers
error "fork/exec /var/task/main: no such file or directory" while executing aws-lambda function
Getting error fork/exec /var/task/main: no such file or directory while executing lambda function.
I am using windows platform to run and build code in Go.
I have done following steps to deploy go aws-lambda handler:
Written code in go language…

Pooja K Bhatt
- 979
- 2
- 10
- 18
51
votes
5 answers
How to use postDelayed() correctly in Android Studio?
I have a countDownTimer and if the user does not hit the gameButton within the 12th second I want the gameOver method called.
The problem is that either the game function instantly gets called when the countDownTimer is 12 or the timer just keeps…

Ryder Thacker
- 1,472
- 3
- 13
- 33
50
votes
6 answers
Uncaught TypeError: Cannot set property 'onclick' of null
I'm having problems making my window alert pop up with a simple checkbox and can't for the life of me figure out why. Here's the basic Javascript and HTML:
var blue_box=document.getElementById("color-blue");
function colorFunction() {
…

user1279662
- 501
- 1
- 4
- 5
49
votes
4 answers
How to return a result through multiple activities
in some part of my application there is a structure of activities like this:
Activity A is my home activity where I come back after each process or flow.
Activity B is a simple confirmation activity.
Activity C is another confirmation…

jalv1039
- 1,663
- 3
- 17
- 21