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
25
votes
2 answers
jQuery ajaxError() handler fires if user leaves page before page finishes loading
We use jQuery's global ajaxError() handler to alert the user of any AJAX failures:
$(document).ajaxError(function() {
$("There was a network or server error. Please try again later.").dialog({
title: "Error",
modal: true, …

richardkmiller
- 2,902
- 3
- 31
- 29
24
votes
1 answer
Moving a custom configuration group to a separate file
I've recently wrote a rather large custom configuration group. I'm curious if it is possible to move this configuration to a separate file via the following:
…

Alexis Abril
- 6,389
- 6
- 33
- 53
23
votes
6 answers
Updating UI with Runnable & postDelayed not working with timer app
I have looked at every discussion and thread I can find on getting this to work but it is not. I have a simple timer that updates a text view (mTimeTextField in the example below). The mUpdateTimeTask run method is being executed correctly (every…

bdelliott
- 463
- 1
- 7
- 12
23
votes
10 answers
Web API - 405 - The requested resource does not support http method 'PUT'
I have a Web API project and I am unable to enable "PUT/Patch" requests against it.
The response I get from fiddler is:
HTTP/1.1 405 Method Not Allowed
Cache-Control: no-cache
Pragma: no-cache
Allow: GET,POST,DELETE
Content-Type: application/json;…

LeeVDuhl
- 231
- 1
- 2
- 4
22
votes
4 answers
Android Handlers - inter-thread communication
How do you implement two-way communication between two threads with Handlers in Android?
I have a Service A that spawns thread B. It's fairly easy to communicate from B to A, it's just to pass a Handler to the constructor of B, but how to do it from…

ohm
- 283
- 1
- 3
- 8
22
votes
4 answers
Put an object in Handler message
I need to download an image from the internet,
in a different thread,
and then send that image object in the handler message, to the UI thread.
I already have this:
...
Message msg = Message.obtain();
Bundle b = new…

Tsimmi
- 1,828
- 6
- 23
- 35
22
votes
2 answers
onClick priority over addEventListener in javascript?
Right now, I have an event listener that listens to a click on the screen. There is also a button on the screen. When I click on the button the event listener will execute before the onclick. Is there a way I can make onclick have higher…

BlueElixir
- 3,299
- 8
- 20
- 23
22
votes
4 answers
Ansible handler does not run multiple handler tasks
We have one Ansible role that needs to run three tasks in the handlers/main.yml task file, but it only runs the first task. How do I force it to run the other two tasks? I do have the ignore flag on for if the first task fails.
The tasks/main.yml…

Nova
- 1,234
- 3
- 12
- 25
21
votes
3 answers
What is the difference between a Thread and a Handler
I'm trying to find out the difference between a thread and a handler. Does creating a new handler create a new thread?. When a new handler is run using post(), is it creating a new thread? Please explain

abat
- 655
- 1
- 9
- 19
21
votes
6 answers
Can't create handler inside thread that has not called Looper.prepare()
I get this error "Can't create handler inside thread that has not called Looper.prepare()"
Can you tell me how to fix it?
public class PaymentActivity extends BaseActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
…

Sergio
- 529
- 3
- 12
- 26
21
votes
2 answers
How to set event handler in React sub-component
I'm having trouble getting menu items connected to an event handler. Here's a mock of the UI showing state changes over time. It's a dropdown menu (via Bootstrap), with the root menu item showing the current selection:
[ANN]

clozach
- 5,118
- 5
- 41
- 54
21
votes
3 answers
PDF Handler : content-disposition filename
I am outputting a PDF file in a Web browser (IE8) HttpContext.Response.writefile(fileName) and it works great. When I try to save the file, it will give me the name of the ashx handler as a default. I would like to actually pass the real name.
I…

user2062308
- 213
- 1
- 2
- 5
19
votes
5 answers
Handler to run task every 5 seconds Kotlin
I would like to run a certain code every 5 seconds. I am having trouble achieving this with a handler. How can this be done in Kotlin? Here is what I have so far. Also to note, the variable Timer_Preview is a Handler.

Ryan Dailey
- 286
- 1
- 6
- 13
18
votes
1 answer
Asp.NET Handler and Generic Handler
In Visual Studio 2010, when you say new Item, you can see Asp.NET Handler and Generic Handler. Can you tell me what's the difference, I think it came with .NET 4.0 because I couldn't find related thins on Google.
Thanks.

Tarik
- 79,711
- 83
- 236
- 349
17
votes
2 answers
Android: one handler for all runnables?
Can I use one handler in my Activity for all runnables or should I have multiple instances of Handler, each for one runnable?

c0dehunter
- 6,412
- 16
- 77
- 139